Exploring potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019)

Author

Arthur R. Magalhães, Daniel Vartanian & Aline Martins de Carvalho

Published

2025-01-29

Overview

This report explores potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019). It is part of the Sustentarea Research and Extension Group’s project titled Global syndemic: The impact of anthropogenic climate change on the health and nutrition of children under five years old served by Brazil’s public health system (SUS).

Please note that this report is designed to support decision-making and may not include all the details of the analysis.

Methods

Approach and Procedure Method

The analysis was conducted using Generalized Additive Models (GAMs) to model and control for potential effects, alongside visual inspections of the data. Results are also presented for each cluster of the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) (Carvalho et al., 2021; Norde et al., 2023).

Any additional analyses or updates will be incorporated into this report in future revisions, if necessary.

Source of Data/Information

The data used in this analysis have as sources:

  • The Brazilian Institute of Geography and Statistics (IBGE) Automatic Retrieval System (SIDRA), for data on GDP per capita.
  • Brazil’s Food and Nutrition Surveillance System (SISVAN), for data on malnutrition.
  • WorldClim, for data on bioclimatic variables, which allowed us to calculate the Standardised Precipitation Evapotranspiration Index (SPEI) for municipalities in Brazil.

Some of the data are embedded in the document, while others rely on external data files available in the data directory of the code repository.

Data Wrangling

Data wrangling and analysis followed the data science framework outlined by Wickham et al. (2023), as illustrated in Figure 1. All processes were made using the R programming language (R Core Team, n.d.), RStudio IDE (Posit Team, n.d.), and several R packages.

The tidyverse and rOpenSci peer-reviewed package ecosystem and other R packages adherents of the tidy tools manifesto (Wickham et al., 2023) were prioritized. All processes were made in order to provide result reproducibility and to be in accordance with the FAIR principles (Wilkinson et al., 2016).

Figure 1: Model of the data science process created by Wickham, Çetinkaya-Runde, and Grolemund.

Source: Reproduced from Wickham et al. (2023).

The Tidyverse code style guide and design principles were followed to ensure consistency and enhance readability.

All the analyses are 100% reproducible and can be run again at any time. See the README file in the code repository to learn how to run them.

Model Parameters

The models were built using the mgcv R package (Wood, n.d.). Since the dependent variables are relative frequencies (continuous), we used the beta distribution family (Figure 2) with a logit link function (Equation 1)(Figure 3)(see Casella & Berger (2002)[p. 591). The REML (Restricted Maximum Likelihood) method was used to estimate the smoothing parameters.

Code
list <- 
  dplyr::tibble(
    alpha = c(0.5, 5, 1, 2, 2),
    beta = c(0.5, 1, 3, 2, 5),
    color = c(
      "a = b == 0.5",
      "a = 5, b = 1",
      "a = 1, b = 3",
      "a = 2, b = 2",
      "a = 2, b = 5"
    )
  ) %>%
  split(., seq(nrow(.)))

plot <- 
  ggplot2::ggplot(NULL, ggplot2::aes(x = x, color = color)) +
  ggplot2::labs(
    x = "x", 
    y = "Probability Density Function (PDF)",
    color = "Parameters"
  ) +
  ggplot2::scale_y_continuous(limits = c(0, 2.5))+
  scale_color_brand_d()

for (i in list) {
  plot <-
    plot +
    ggplot2::stat_function(
      data = dplyr::tibble(x = 0:1, color = factor(i$color)),
      fun = stats::dbeta,
      args = list(shape1 = i$alpha, shape2 = i$beta),
      n = 1000,
      linewidth = 1.5
    )
}

plot |> print() |> rutils::shush()
Figure 2: Examples of beta distributions with different parameters.

Source: Created by the authors.

\[ \text{logit}(P) = \ln\left(\frac{P}{1 - P}\right) = \beta_{0} + \beta_{1} X_{1} + \cdots + \beta_{k} X_{k} \tag{1}\]

Code
ggplot2::ggplot() +
  ggplot2::stat_function(
    data = dplyr::tibble(x = 0:1, color = factor(i$color)),
    fun = stats::qlogis,
    args = list(location = 0, scale = 1, log = FALSE),
    n = 1000,
    linewidth = 1.5,
    color = get_brand_color("red")
  ) +
  ggplot2::geom_hline(
    yintercept = 0, 
    linewidth = 0.25,
    linetype = "dashed",
    color = get_brand_color("grey")
  ) +
  ggplot2::geom_vline(
    xintercept = 0.5, 
    linewidth = 0.25,
    linetype = "dashed",
    color = get_brand_color("grey")
  ) +
  ggplot2::lims(
    x = c(0, 1),
    y = c(-6, 6)
  ) +
  ggplot2::labs(
    x = "Probability",
    y = "Logit(0,1)"
  )
Figure 3: Example of a logit function (i.e., the quantile function of the logistic distribution).

Source: Created by the authors.

Interpretation of Results

Standardized Precipitation Evapotranspiration Index (SPEI)

Since the original SPEI authors (Vicente-Serrano et al., 2010) did not establish definitive thresholds for SPEI values and their corresponding drought conditions, we adopt the benchmark values provided by Mehr et al. (2020) (Table 1).

Table 1: Classifications of wet and dry conditions using SPI and SPEI indices.
Classification SPI Threshold SPEI Threshold
Extremely wet 2.0 ≤ SPI 1.83 ≤ SPEI
Severely wet 2.0 > SPI ≥ 1.5 1.82 > SPEI ≥ 1.43
Moderately wet 1.49 > SPI ≥ 1.0 1.42 > SPEI ≥ 1.0
Near normal -1.0 ≤ SPI ≤ 1.0 -1.0 ≤ SPEI ≤ 1.0
Moderate drought (MoD) -1.49 ≤ SPI < -1.0 -1.42 ≤ SPEI < -1.0
Severe drought (SD) -2.0 ≤ SPI < -1.5 -1.82 ≤ SPEI < -1.43
Extreme drought (ED) SPI < -2.0 SPEI < -1.83

Source: Reproduced from Mehr et al. (2020).

Revised Multidimensional Index for Sustainable Food Systems (MISFS-R)

The Multidimensional Index for Sustainable Food Systems (MISFS) is a tool designed to measure the sustainability of food systems at a subnational level, specifically created for Brazil, taking into account local behaviours and practices. The MISFS-R is a revised version of the MISFS, which includes new indicators and a new methodology for calculating the index Figure 4. See Carvalho et al. (2021) and Norde et al. (2023) to learn more.

Figure 4: Dendrogram for cluster analysis between Brazilian states considering all the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) indicators and geographical location of each cluster.

Source: Reproduced from Norde et al. (2023).

Pratical Significance

To ensure practical significance, the adjusted \(\text{R}^2\) of the models are analysed for their effect sizes considering a confidence interval of \(0.95\). We use Cohen (1988) benchmark for interpretation.

A \(\text{R}^2\) less than \(\approx 0.0196\) is considered negligeble.

SMALL EFFECT SIZE: \(f^2 = .02\). Translated into \(\text{R}^{2}\) or partial \(\text{R}^{2}\) for Case 1, this gives \(.02 / (1 + .02) = .0196\). We thus define a small effect as one that accounts for 2% of the \(\text{Y}\) variance (in contrast with 1% for \(r\)), and translate to an \(\text{R} = \sqrt{0196} = .14\) (compared to .10 for \(r\)). This is a modest enough amount, just barely escaping triviality and (alas!) all too frequently in practice represents the true order of magnitude of the effect being tested (Cohen, 1988, p. 413).

[…] in many circumstances, all that is intended by “proving” the null hypothesis is that the ES [Effect Size] is not necessarily zero but small enough to be negligible […]. (Cohen, 1988, p. 461).

Setting the Enviroment

Code
source(here::here("R", "get_and_aggregate_sidra_by_year.R"))
source(here::here("R", "gam_misfs.R"))
source(here::here("R", "plot_brazil.R"))
source(here::here("R", "plot_dist.R"))
source(here::here("R", "plot_gam.R"))
source(here::here("R", "plot_ggally.R"))
source(here::here("R", "summarise_coefs.R"))
source(here::here("R", "summarise_r2.R"))
source(here::here("R", "tabset_panel_brazil_municipality.R"))
source(here::here("R", "tabset_panel_gam.R"))
source(here::here("R", "tabset_panel_var_distribution.R"))
source(here::here("R", "tabset_panel_var_distribution_by_misfs.R"))
source(here::here("R", "utils.R"))
source(here::here("R", "utils-plots.R"))

Importing and Tidying the Data

Nutrition Data

Based on SISVAN Nutritional Status dataset (Sistema de Vigilância Alimentar e Nutricional, n.d.).

Code
nutrition_data <-
  here::here("data", "Banco_dados_malnutritio_clima - Adaptado.csv") |>
  readr::read_csv(col_types = readr::cols(.default = "c")) |>
  janitor::clean_names() |>
  dplyr::rename(
    year = ano,
    municipality_code = code_muni,
    sisvan_cover = cobrs,
    number_of_children = n_ao_de_criana_as_municipio_x,
    n_mbepr = muito_baixa_e_i_n_x,
    n_beipr = baixa_e_i_n_x,
    n_maper = magreza_acentuada_p_e_n_x,
    n_mpepr = magreza_p_e_n_x
  ) |>
  dplyr::select(
    year, municipality_code, misf, number_of_children, sisvan_cover,
    n_mbepr, n_beipr, n_maper, n_mpepr
  ) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::all_of(
        c("number_of_children", "n_mbepr", "n_beipr", "n_maper", "n_mpepr")
      ),
      .fns = ~ 
        dplyr::case_when(
          !(as.numeric(.x) %% 1 == 0) ~ stringr::str_remove(.x, "\\."),
          TRUE ~ .x
        ) |>
        as.integer()
    )
  ) |>
  dplyr::mutate(
    # year = as.integer(year),
    year =
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      ),
    municipality_code = as.integer(municipality_code),
    misf = factor(misf, levels = c("A", "B", "C", "D"), ordered = FALSE),
    sisvan_cover = as.numeric(sisvan_cover),
    mbepr = n_mbepr,
    beipr = n_beipr,
    n_mbepr_beipr = n_mbepr + n_beipr,
    mbepr_beipr = n_mbepr_beipr,
    maper = n_maper,
    mpepr = n_mpepr,
    n_maper_mpepr = n_maper + n_mpepr,
    maper_mpepr = n_maper_mpepr
  ) |>
  dplyr::filter(
    dplyr::between(sisvan_cover, 0, 1),
    number_of_children >= 0,
    number_of_children > n_mbepr,
    number_of_children > n_beipr,
    number_of_children > mbepr_beipr,
    number_of_children > n_maper,
    number_of_children > n_mpepr,
    number_of_children > maper_mpepr
  ) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::all_of(
        c("mbepr", "beipr", "mbepr_beipr", "maper", "mpepr", "maper_mpepr")
      ),
      .fns = ~
        .x  %>%
      `/`(number_of_children * sisvan_cover)
    ),
    dplyr::across(
      .cols = dplyr::all_of(
        c("mbepr", "beipr", "mbepr_beipr", "maper", "mpepr", "maper_mpepr")
      ),
      .fns = ~ pmax(0.00001, pmin(.x, 0.99999))
    )
  ) |>
  dplyr::select(
    year, municipality_code, misf, number_of_children, sisvan_cover, 
    n_mbepr, mbepr, n_beipr, beipr, n_mbepr_beipr, mbepr_beipr,
    n_maper, maper, n_mpepr, mpepr, n_maper_mpepr, maper_mpepr
  )

GDP Per Capita Data

Source: IBGE-SIDRA Table 5938 – Gross domestic product at current prices, taxes net of subsidies on products at current prices, and gross value added at current prices, total and by economic activity, and their respective shares - Reference year 2010 (Instituto Brasileiro de Geografia e Estatística, n.d.-a).

Code
tictoc::tic()

ibge_table_5938 <- 
  get_and_aggregate_sidra_by_year(
    years = nutrition_data$year |> unique(),
    api_start = "/t/5938/n6/all/v/37/p/",
    api_end = "/d/v37%200"
  ) |>
  regularize_col_names()

tictoc::toc()

beepr::beep(1)
Sys.sleep(3)
Code
# Last download: 2025-01-22 (~6m1s)

ibge_table_5938 |> 
  saveRDS(here::here("data", "ibge-table-5938.rds"))

ibge_table_5938 |> 
  readr::write_csv(here::here("data", "ibge-table-5938.csv"))

Source: IBGE-SIDRA Table 6579 – Estimated resident population (Instituto Brasileiro de Geografia e Estatística, n.d.-b).

Code
tictoc::tic()

ibge_table_6579 <- 
  get_and_aggregate_sidra_by_year(
    years = nutrition_data$year |> unique(),
    api_start = "/t/6579/n6/all/v/all/p/",
    api_end = ""
  ) |>
  regularize_col_names()

tictoc::toc()

beepr::beep(1)
Sys.sleep(3)
Code
# Last download: 2025-01-22 (~4m42s)

ibge_table_6579 |> 
  saveRDS(here::here("data", "ibge-table-6579.rds"))

ibge_table_6579 |> 
  readr::write_csv(here::here("data", "ibge-table-6579.csv"))
Code
gdp_data <- 
  ibge_table_5938 |>
  dplyr::left_join(
    ibge_table_6579,
    by = c("year", "municipality_code")
  ) |>
  dplyr::select(year, municipality_code, municipality.x, value.x, value.y) |>
  dplyr::rename(
    gdp = value.x,
    population = value.y,
    municipality = municipality.x
  ) |>
  dplyr::filter(gdp >= 0, population >= 0) |>
  dplyr::mutate(
    # year = as.integer(year),
    year =
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      ),
    gdp = gdp * 1000,
    gdp_per_capita = gdp / population,
    municipality_code = municipality_code |> as.integer()
  )

SPEI Data

Based on WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Code
spei_data <- 
  here::here("data", "spei_Extreme_drought_event_municipality_year2.csv") |>
  readr::read_csv(col_types = readr::cols(.default = "c")) |>
  janitor::clean_names() |>
  dplyr::rename(municipality_code = code_muni) |>
  dplyr::select(
    municipality_code, 
    dplyr::all_of(paste0("spei_12m_", nutrition_data$year |> unique()))
  ) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::starts_with("spei_12m"),
      .fns = as.numeric
    )
  ) |>
  tidyr::pivot_longer(
    cols = starts_with("spei_12m"),
    names_to = "year",
    values_to = "spei_12m"
  ) |>
  dplyr::mutate(
    year =
      year |>
      stringr::str_remove("spei_12m_") |>
      as.integer(),
    year = 
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      ),
    municipality_code = municipality_code |> as.integer()
  )

Analysis Data

Code
data <- 
  nutrition_data |>
  dplyr::mutate(year = year |> as.character()) |>
  # In order to adapt the data to the municipalities in the nutrition data
  # since it does not have the check digit.
  dplyr::rename(temp_municipality_code = municipality_code) |>
  dplyr::left_join(
    y = gdp_data |> 
      dplyr::mutate(
        year = year |> as.character(),
        temp_municipality_code =
          municipality_code |>
          stringr::str_sub(end = -2) |>
          as.integer()
      ),
    by = c("year", "temp_municipality_code")
  ) |>
  dplyr::left_join(
    y = spei_data |>
      dplyr::mutate(
        year = year |> as.character(),
        # In order to adapt the data to the municipalities 
        # in the nutrition data (...)
        temp_municipality_code =
          municipality_code |>
          stringr::str_sub(end = -2) |>
          as.integer()
      ),
    by = c("year", "temp_municipality_code")
  ) |>
  dplyr::rename(municipality_code = municipality_code.x) |>
  dplyr::select(
    year, municipality_code, misf, number_of_children, sisvan_cover, 
    mbepr, beipr, mbepr_beipr, maper, mpepr, maper_mpepr,
    gdp_per_capita, spei_12m
  ) |>
  dplyr::mutate(
    # year = as.integer(year),
    year =
      year |>
      factor(
        levels = year |> unique() |> sort(),
        ordered = TRUE
      )
  ) |>
  tidyr::drop_na(sisvan_cover)
Code
dplyr::tibble(
  n = data |> nrow(),
  n_sisvan_cover_less_than_0_05 = 
    data |> 
    dplyr::filter(sisvan_cover < 0.05) |> 
    nrow(),
  n_sisvan_cover_more_than_1 =
    data |> 
    dplyr::filter(sisvan_cover > 1) |> 
    nrow(),
  n_brazil_municipalities =
    geobr::read_municipality(year = 2022, showProgress = FALSE) |> 
    dplyr::pull(code_muni) |> 
    length() |>
    rutils::shush(),
  missing_municipalities = 
    geobr::read_municipality(year = 2022, showProgress = FALSE) |> 
    dplyr::pull(code_muni) |> 
    as.integer() |>
    setdiff(data |> dplyr::pull(municipality_code)) |>
    length() |>
    rutils::shush()
) |>
  tidyr::pivot_longer(cols = dplyr::everything())

Adjusting the data to allow only municipalities with a minimum of \(5\%\) cover from SISVAN.

Code
data <- 
  data |>
  dplyr::filter(sisvan_cover >= 0.05)

data

Dictionary

  • year: Year of data collection.
  • municipality_code: Brazilian Institute of Geography and Statistics (IBGE) municipality code.
  • misf: Cluster of the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) (A, B, C, or D).
  • number_of_children: Number of children under five years old in the municipality.
  • sisvan_cover: Proportion of children under five covered by the Brazilian Food and Nutrition Surveillance System (SISVAN) in the municipality.
  • mbepr: Relative frequency of children under five years old with Very Short Stature for Age (Muito Baixa Estatura Para a Idade) in the municipality.
  • beipr: Relative frequency of children under five years old with Short Stature for Age (Baixa Estatura Para Idade) in the municipality.
  • mbepr_beipr: Relative frequency of children under five years old with Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade) in the municipality.
  • maper: Relative frequency of children under five years old with Severe Thinness for Height (Magreza Acentuada Para a Estatura) in the municipality.
  • mpepr: Relative frequency of children under five years old with Thinness for Height (Magreza Por Estatura) in the municipality.
  • maper_mpepr: Relative frequency of children under five years old with Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura) in the municipality.
  • gdp_per_capita: Gross Domestic Product (GDP) per capita in the municipality in Brazilian Reais (BRL).
  • spei_12m: Standardised Precipitation Evapotranspiration Index (SPEI) in a 12-month times cale for the municipality.

Checking SISVAN Cover

Code
brand_div_palette <- function(x) {
  make_color_vector(
    n_prop = x, 
    colors = c(
      get_brand_color("dark-red"),
      # get_brand_color("white"),
      get_brand_color_mix(
        position = 950,
        color_1 = "dark-red",
        color_2 = "dark-red-triadic-blue",
        alpha = 0.5
      ),
      get_brand_color("dark-red-triadic-blue")
    )
  )
}
Code
# Run this chunk to produce the plots and the animation.

data |> 
  dplyr::mutate(sisvan_cover = sisvan_cover * 100) |>
  animate_plot_brazil_municipality(
    col_fill = "sisvan_cover",
    col_group = "year",
    group_label = "Year",
    comparable_areas = TRUE
    suffix = NULL,
    width = 1344,
    height = 960,
    dpi = 150,
    transform = "identity",
    breaks = seq(0, 100, 25),
    reverse = FALSE,
    limits = c(0, 100),
    palette = brand_div_palette
  )
Figure 5: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008-2019).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 6: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 7: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2009).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 8: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2010).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 9: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2011).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 10: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2012).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 11: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2013).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 12: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2014).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 13: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2015).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 14: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2016).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 15: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2017).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 16: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2018).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Figure 17: Percentage of children under five monitored by Brazil’s Food and Nutrition Surveillance System (SISVAN) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2019).

Source: Created by the authors based on data from Sistema de Vigilância Alimentar e Nutricional (n.d.) and Instituto Brasileiro de Geografia e Estatística (n.d.-b).

Checking SPEI Variations

Year-to-Year comparison

Code
# Run this chunk to produce the plots and the animation.

data |> 
  animate_plot_brazil_municipality(
    col_fill = "spei_12m",
    col_group = "year",
    group_label = "Year",
    comparable_areas = TRUE
    suffix = NULL,
    width = 1344,
    height = 960,
    dpi = 150,
    transform = "identity",
    # breaks = c(-2, -1.83, -1.43, -1, 1, 1.42, 1.82, 2),
    breaks = seq(-2 , 2, 0.5),
    reverse = FALSE,
    limits = c(-2, 2),
    palette = brand_div_palette
  )
Figure 18: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008-2019).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 19: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2008).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 20: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2009).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 21: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2010).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 22: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2011).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 23: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2012).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 24: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2013).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 25: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2014).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 26: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2015).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 27: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2016).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 28: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2017).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 29: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2018).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Figure 30: Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)) (2019).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Comparison with External Data

Figure 31 presents an independent analysis for comparison, while our results are shown in Figure 32.

Figure 31: Average Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)).

Source: Reproduced from Food and Agriculture Organization of the United Nations et al. (2025, fig. VI.1, p. 185).

Code
plot <- 
  data |>
  dplyr::filter(year >= 2010, year <= 2019) |>
  plot_brazil_municipality(
    col_fill = "spei_12m",
    comparable_areas = TRUE,
    transform = "identity",
    binned = FALSE,
    breaks = seq(-2 , 2, 0.5),
    reverse = FALSE,
    limits = c(-2, 2),
    print = FALSE,
    quiet = TRUE,
    palette = function(x) {
      make_color_vector(
        n_prop = x, 
        colors = c(
          "#6F0322",
          "#BC2D32",
          "#E28668",
          "#F9D0BC",
          "#F1F1F3",
          "#BBDAE9",
          "#65A9D1",
          "#266DB1",
          "#0D2648"
        )
      )
    }
  ) +
  ggplot2::labs(title = "2010-2019") +
  ggplot2::theme(plot.title = element_text(hjust = 0.5))

plot |> print() |> rutils::shush()
Figure 32: Average Standardized Precipitation Evapotranspiration Index (SPEI) across Brazil’s historically comparable municipalities (minimum comparable areas (Ehrl, 2017)).

Source: Created by the authors using data from the WorldClim 2.1 Historical Monthly Weather dataset (Fick & Hijmans, 2017; Harris et al., 2020).

Checking Distributions

General Distributions

Code
data |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 2: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 4996 7.96 7.96 7.96 7.96
2009 5253 8.37 16.33 8.37 16.33
2010 5274 8.40 24.73 8.40 24.73
2011 5266 8.39 33.12 8.39 33.12
2012 5288 8.43 41.55 8.43 41.55
2013 5143 8.19 49.74 8.19 49.74
2014 5164 8.23 57.97 8.23 57.97
2015 5229 8.33 66.30 8.33 66.30
2016 5280 8.41 74.72 8.41 74.72
2017 5263 8.39 83.10 8.39 83.10
2018 5271 8.40 91.50 8.40 91.50
2019 5335 8.50 100.00 8.50 100.00
<NA> 0 0.00 100.00
Total 62762 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 33: Bar plot of the year variable.

Source: Created by the authors.

Code
data |>
  summarytools::freq(
    var = misf,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 3: Frequencies of the misf variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
A 7934 12.64 12.64 12.64 12.64
B 31734 50.56 63.20 50.56 63.20
C 20324 32.38 95.59 32.38 95.59
D 2770 4.41 100.00 4.41 100.00
<NA> 0 0.00 100.00
Total 62762 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data |>
  plot_bar(
    col = "misf",
    y_label = "misf"
  )
Figure 34: Bar plot of the misf variable.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 4: Statistics for the number_of_children variable.
  number_of_children
Mean 2498.50
Std.Dev 9764.47
Min 41.00
Q1 399.00
Median 910.00
Q3 2009.00
Max 797644.00
MAD 911.80
IQR 1610.00
CV 3.91
Skewness 32.79
SE.Skewness 0.01
Kurtosis 1888.84
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 35: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 5: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.41
Std.Dev 0.23
Min 0.05
Q1 0.23
Median 0.38
Q3 0.57
Max 1.00
MAD 0.25
IQR 0.34
CV 0.55
Skewness 0.51
SE.Skewness 0.01
Kurtosis -0.55
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 36: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 6: Statistics for the mbepr variable.
  mbepr
Mean 0.06
Std.Dev 0.05
Min 0.00
Q1 0.03
Median 0.05
Q3 0.07
Max 0.89
MAD 0.03
IQR 0.04
CV 0.81
Skewness 3.16
SE.Skewness 0.01
Kurtosis 23.36
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 37: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 7: Statistics for the beipr variable.
  beipr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.69
MAD 0.03
IQR 0.04
CV 0.54
Skewness 1.42
SE.Skewness 0.01
Kurtosis 5.80
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 38: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 8: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.12
Std.Dev 0.07
Min 0.00
Q1 0.08
Median 0.11
Q3 0.15
Max 1.00
MAD 0.06
IQR 0.08
CV 0.58
Skewness 1.77
SE.Skewness 0.01
Kurtosis 6.89
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 39: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 9: Statistics for the maper variable.
  maper
Mean 0.02
Std.Dev 0.03
Min 0.00
Q1 0.01
Median 0.02
Q3 0.03
Max 0.75
MAD 0.02
IQR 0.02
CV 1.05
Skewness 5.34
SE.Skewness 0.01
Kurtosis 68.42
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 40: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 10: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.58
MAD 0.02
IQR 0.02
CV 0.67
Skewness 2.14
SE.Skewness 0.01
Kurtosis 23.16
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 41: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 11: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.05
Std.Dev 0.04
Min 0.00
Q1 0.03
Median 0.05
Q3 0.07
Max 0.91
MAD 0.03
IQR 0.04
CV 0.73
Skewness 3.14
SE.Skewness 0.01
Kurtosis 27.23
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 42: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 12: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 18045.58
Std.Dev 20454.91
Min 301.61
Q1 7485.60
Median 12703.63
Q3 22238.03
Max 815697.80
MAD 9267.71
IQR 14751.90
CV 1.13
Skewness 8.75
SE.Skewness 0.01
Kurtosis 179.42
N.Valid 57487.00
Pct.Valid 91.60

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 43: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 13: Statistics for the spei_12m variable.
  spei_12m
Mean -0.18
Std.Dev 0.41
Min -1.75
Q1 -0.48
Median -0.17
Q3 0.11
Max 1.03
MAD 0.44
IQR 0.59
CV -2.27
Skewness -0.08
SE.Skewness 0.01
Kurtosis -0.44
N.Valid 62762.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 44: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

By MISFS-R Clusters

Code
categories <- c("A", "B", "C", "D")

for (i in categories) {
  i_data_name  <- paste0("data_misfs_", tolower(i))
  
  assign(
    i_data_name,
    data |> dplyr::filter(misf == i)
  )
}

A

Code
data_misfs_a |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 14: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 615 7.75 7.75 7.75 7.75
2009 662 8.34 16.10 8.34 16.10
2010 663 8.36 24.45 8.36 24.45
2011 666 8.39 32.85 8.39 32.85
2012 665 8.38 41.23 8.38 41.23
2013 667 8.41 49.63 8.41 49.63
2014 670 8.44 58.08 8.44 58.08
2015 669 8.43 66.51 8.43 66.51
2016 663 8.36 74.87 8.36 74.87
2017 662 8.34 83.21 8.34 83.21
2018 663 8.36 91.57 8.36 91.57
2019 669 8.43 100.00 8.43 100.00
<NA> 0 0.00 100.00
Total 7934 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 45: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 15: Statistics for the number_of_children variable.
  number_of_children
Mean 1877.77
Std.Dev 5272.84
Min 59.00
Q1 325.00
Median 682.50
Q3 1554.00
Max 94954.00
MAD 651.60
IQR 1228.50
CV 2.81
Skewness 9.42
SE.Skewness 0.03
Kurtosis 117.89
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 46: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 16: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.34
Std.Dev 0.18
Min 0.05
Q1 0.20
Median 0.30
Q3 0.44
Max 1.00
MAD 0.16
IQR 0.24
CV 0.54
Skewness 0.98
SE.Skewness 0.03
Kurtosis 0.79
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 47: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 17: Statistics for the mbepr variable.
  mbepr
Mean 0.06
Std.Dev 0.05
Min 0.00
Q1 0.03
Median 0.05
Q3 0.08
Max 0.78
MAD 0.03
IQR 0.04
CV 0.79
Skewness 3.77
SE.Skewness 0.03
Kurtosis 33.23
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 48: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 18: Statistics for the beipr variable.
  beipr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.69
MAD 0.03
IQR 0.04
CV 0.56
Skewness 2.01
SE.Skewness 0.03
Kurtosis 16.06
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 49: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 19: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.13
Std.Dev 0.07
Min 0.00
Q1 0.08
Median 0.11
Q3 0.16
Max 1.00
MAD 0.06
IQR 0.08
CV 0.57
Skewness 2.25
SE.Skewness 0.03
Kurtosis 12.63
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 50: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 20: Statistics for the maper variable.
  maper
Mean 0.03
Std.Dev 0.03
Min 0.00
Q1 0.01
Median 0.02
Q3 0.04
Max 0.59
MAD 0.02
IQR 0.02
CV 1.03
Skewness 5.40
SE.Skewness 0.03
Kurtosis 61.28
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 51: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 21: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.46
MAD 0.02
IQR 0.02
CV 0.67
Skewness 2.53
SE.Skewness 0.03
Kurtosis 26.20
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 52: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 22: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.06
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.05
Q3 0.08
Max 0.91
MAD 0.03
IQR 0.04
CV 0.71
Skewness 4.02
SE.Skewness 0.03
Kurtosis 41.22
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 53: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 23: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 22058.96
Std.Dev 20696.45
Min 3522.11
Q1 11119.05
Median 16237.33
Q3 25444.64
Max 362079.97
MAD 9273.49
IQR 14319.14
CV 0.94
Skewness 5.12
SE.Skewness 0.03
Kurtosis 47.82
N.Valid 7271.00
Pct.Valid 91.64

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 54: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_a |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 24: Statistics for the spei_12m variable.
  spei_12m
Mean -0.31
Std.Dev 0.41
Min -1.64
Q1 -0.60
Median -0.27
Q3 -0.03
Max 1.03
MAD 0.42
IQR 0.57
CV -1.31
Skewness -0.20
SE.Skewness 0.03
Kurtosis -0.31
N.Valid 7934.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_a |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 55: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

B

Code
data_misfs_b |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 25: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 2539 8.00 8.00 8.00 8.00
2009 2662 8.39 16.39 8.39 16.39
2010 2689 8.47 24.86 8.47 24.86
2011 2668 8.41 33.27 8.41 33.27
2012 2663 8.39 41.66 8.39 41.66
2013 2556 8.05 49.72 8.05 49.72
2014 2560 8.07 57.78 8.07 57.78
2015 2619 8.25 66.04 8.25 66.04
2016 2665 8.40 74.43 8.40 74.43
2017 2664 8.39 82.83 8.39 82.83
2018 2710 8.54 91.37 8.54 91.37
2019 2739 8.63 100.00 8.63 100.00
<NA> 0 0.00 100.00
Total 31734 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 56: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 26: Statistics for the number_of_children variable.
  number_of_children
Mean 2433.14
Std.Dev 11344.02
Min 41.00
Q1 305.00
Median 647.00
Q3 1627.00
Max 797644.00
MAD 644.93
IQR 1322.00
CV 4.66
Skewness 36.48
SE.Skewness 0.01
Kurtosis 1983.24
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 57: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 27: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.38
Std.Dev 0.24
Min 0.05
Q1 0.18
Median 0.32
Q3 0.54
Max 1.00
MAD 0.24
IQR 0.36
CV 0.64
Skewness 0.74
SE.Skewness 0.01
Kurtosis -0.45
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 58: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 28: Statistics for the mbepr variable.
  mbepr
Mean 0.04
Std.Dev 0.04
Min 0.00
Q1 0.02
Median 0.04
Q3 0.06
Max 0.89
MAD 0.03
IQR 0.04
CV 0.94
Skewness 3.80
SE.Skewness 0.01
Kurtosis 32.09
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 59: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 29: Statistics for the beipr variable.
  beipr
Mean 0.06
Std.Dev 0.03
Min 0.00
Q1 0.04
Median 0.05
Q3 0.07
Max 0.49
MAD 0.02
IQR 0.03
CV 0.56
Skewness 1.45
SE.Skewness 0.01
Kurtosis 6.36
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 60: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 30: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.10
Std.Dev 0.06
Min 0.00
Q1 0.06
Median 0.09
Q3 0.12
Max 0.89
MAD 0.05
IQR 0.06
CV 0.61
Skewness 2.16
SE.Skewness 0.01
Kurtosis 10.79
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 61: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 31: Statistics for the maper variable.
  maper
Mean 0.02
Std.Dev 0.02
Min 0.00
Q1 0.01
Median 0.01
Q3 0.03
Max 0.75
MAD 0.01
IQR 0.02
CV 1.22
Skewness 5.57
SE.Skewness 0.01
Kurtosis 78.88
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 62: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 32: Statistics for the mpepr variable.
  mpepr
Mean 0.02
Std.Dev 0.02
Min 0.00
Q1 0.01
Median 0.02
Q3 0.03
Max 0.40
MAD 0.01
IQR 0.02
CV 0.81
Skewness 2.18
SE.Skewness 0.01
Kurtosis 13.89
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 63: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 33: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.04
Std.Dev 0.04
Min 0.00
Q1 0.02
Median 0.04
Q3 0.06
Max 0.75
MAD 0.02
IQR 0.03
CV 0.83
Skewness 3.18
SE.Skewness 0.01
Kurtosis 26.11
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 64: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 34: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 23457.49
Std.Dev 23488.35
Min 2729.65
Q1 11984.65
Median 18584.56
Q3 27952.20
Max 815697.80
MAD 11122.91
IQR 15967.55
CV 1.00
Skewness 9.28
SE.Skewness 0.01
Kurtosis 182.88
N.Valid 29045.00
Pct.Valid 91.53

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 65: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_b |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 35: Statistics for the spei_12m variable.
  spei_12m
Mean -0.08
Std.Dev 0.36
Min -1.24
Q1 -0.34
Median -0.07
Q3 0.17
Max 0.78
MAD 0.37
IQR 0.51
CV -4.74
Skewness -0.01
SE.Skewness 0.01
Kurtosis -0.58
N.Valid 31734.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_b |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 66: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

C

Code
data_misfs_c |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 36: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 1625 8.00 8.00 8.00 8.00
2009 1702 8.37 16.37 8.37 16.37
2010 1690 8.32 24.69 8.32 24.69
2011 1700 8.36 33.05 8.36 33.05
2012 1728 8.50 41.55 8.50 41.55
2013 1685 8.29 49.84 8.29 49.84
2014 1700 8.36 58.21 8.36 58.21
2015 1705 8.39 66.60 8.39 66.60
2016 1718 8.45 75.05 8.45 75.05
2017 1704 8.38 83.43 8.38 83.43
2018 1668 8.21 91.64 8.21 91.64
2019 1699 8.36 100.00 8.36 100.00
<NA> 0 0.00 100.00
Total 20324 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 67: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 37: Statistics for the number_of_children variable.
  number_of_children
Mean 2439.41
Std.Dev 7494.04
Min 96.00
Q1 636.00
Median 1213.00
Q3 2206.00
Max 206458.00
MAD 1024.48
IQR 1570.00
CV 3.07
Skewness 16.77
SE.Skewness 0.02
Kurtosis 368.16
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 68: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 38: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.50
Std.Dev 0.19
Min 0.05
Q1 0.36
Median 0.49
Q3 0.62
Max 1.00
MAD 0.20
IQR 0.27
CV 0.39
Skewness 0.17
SE.Skewness 0.02
Kurtosis -0.36
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 69: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 39: Statistics for the mbepr variable.
  mbepr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.71
MAD 0.03
IQR 0.04
CV 0.64
Skewness 3.00
SE.Skewness 0.02
Kurtosis 20.44
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 70: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 40: Statistics for the beipr variable.
  beipr
Mean 0.08
Std.Dev 0.03
Min 0.00
Q1 0.06
Median 0.07
Q3 0.09
Max 0.38
MAD 0.03
IQR 0.03
CV 0.40
Skewness 1.12
SE.Skewness 0.02
Kurtosis 2.98
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 71: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 41: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.14
Std.Dev 0.07
Min 0.00
Q1 0.10
Median 0.13
Q3 0.17
Max 0.78
MAD 0.05
IQR 0.07
CV 0.45
Skewness 1.69
SE.Skewness 0.02
Kurtosis 6.25
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 72: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 42: Statistics for the maper variable.
  maper
Mean 0.03
Std.Dev 0.03
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.69
MAD 0.02
IQR 0.02
CV 0.85
Skewness 5.82
SE.Skewness 0.02
Kurtosis 73.54
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 73: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 43: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.26
MAD 0.01
IQR 0.02
CV 0.48
Skewness 1.42
SE.Skewness 0.02
Kurtosis 6.23
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 74: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 44: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.07
Std.Dev 0.04
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.74
MAD 0.03
IQR 0.04
CV 0.58
Skewness 3.47
SE.Skewness 0.02
Kurtosis 29.22
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 75: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 45: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 8964.53
Std.Dev 9688.17
Min 301.61
Q1 5145.99
Median 6999.36
Q3 9466.20
Max 296621.36
MAD 3086.89
IQR 4320.21
CV 1.08
Skewness 9.54
SE.Skewness 0.02
Kurtosis 162.45
N.Valid 18633.00
Pct.Valid 91.68

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 76: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_c |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 46: Statistics for the spei_12m variable.
  spei_12m
Mean -0.29
Std.Dev 0.45
Min -1.42
Q1 -0.63
Median -0.34
Q3 0.05
Max 0.89
MAD 0.48
IQR 0.67
CV -1.57
Skewness 0.23
SE.Skewness 0.02
Kurtosis -0.61
N.Valid 20324.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_c |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 77: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

D

Code
data_misfs_d |>
  summarytools::freq(
    var = year,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 47: Frequencies of the year variable.
  Freq % Valid % Valid Cum. % Total % Total Cum.
2008 217 7.83 7.83 7.83 7.83
2009 227 8.19 16.03 8.19 16.03
2010 232 8.38 24.40 8.38 24.40
2011 232 8.38 32.78 8.38 32.78
2012 232 8.38 41.16 8.38 41.16
2013 235 8.48 49.64 8.48 49.64
2014 234 8.45 58.09 8.45 58.09
2015 236 8.52 66.61 8.52 66.61
2016 234 8.45 75.05 8.45 75.05
2017 233 8.41 83.47 8.41 83.47
2018 230 8.30 91.77 8.30 91.77
2019 228 8.23 100.00 8.23 100.00
<NA> 0 0.00 100.00
Total 2770 100.00 100.00 100.00 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_bar(
    col = "year",
    y_label = "year"
  )
Figure 78: Bar plot of the year variable.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = number_of_children,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 48: Statistics for the number_of_children variable.
  number_of_children
Mean 5458.81
Std.Dev 13582.98
Min 274.00
Q1 1730.00
Median 2901.50
Q3 5084.00
Max 176505.00
MAD 2058.59
IQR 3353.50
CV 2.49
Skewness 9.79
SE.Skewness 0.05
Kurtosis 110.53
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "number_of_children",
    jitter = FALSE
  )
Figure 79: Histogram of the number_of_children variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = sisvan_cover,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 49: Statistics for the sisvan_cover variable.
  sisvan_cover
Mean 0.37
Std.Dev 0.18
Min 0.05
Q1 0.22
Median 0.34
Q3 0.49
Max 1.00
MAD 0.20
IQR 0.27
CV 0.50
Skewness 0.59
SE.Skewness 0.05
Kurtosis 0.00
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "sisvan_cover",
    jitter = FALSE
  )
Figure 80: Histogram of the sisvan_cover variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = mbepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 50: Statistics for the mbepr variable.
  mbepr
Mean 0.09
Std.Dev 0.06
Min 0.00
Q1 0.06
Median 0.08
Q3 0.11
Max 0.70
MAD 0.04
IQR 0.05
CV 0.60
Skewness 2.83
SE.Skewness 0.05
Kurtosis 15.78
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "mbepr",
    jitter = FALSE
  )
Figure 81: Histogram of the mbepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 51: Statistics for the beipr variable.
  beipr
Mean 0.13
Std.Dev 0.05
Min 0.00
Q1 0.09
Median 0.12
Q3 0.15
Max 0.37
MAD 0.04
IQR 0.06
CV 0.36
Skewness 0.82
SE.Skewness 0.05
Kurtosis 1.03
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "beipr",
    jitter = FALSE
  )
Figure 82: Histogram of the beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = mbepr_beipr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 52: Statistics for the mbepr_beipr variable.
  mbepr_beipr
Mean 0.22
Std.Dev 0.09
Min 0.02
Q1 0.16
Median 0.21
Q3 0.27
Max 0.77
MAD 0.08
IQR 0.11
CV 0.40
Skewness 1.15
SE.Skewness 0.05
Kurtosis 2.43
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "mbepr_beipr",
    jitter = FALSE
  )
Figure 83: Histogram of the mbepr_beipr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = maper,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 53: Statistics for the maper variable.
  maper
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.02
Q3 0.03
Max 0.25
MAD 0.01
IQR 0.02
CV 0.70
Skewness 3.74
SE.Skewness 0.05
Kurtosis 26.00
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "maper",
    jitter = FALSE
  )
Figure 84: Histogram of the maper variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 54: Statistics for the mpepr variable.
  mpepr
Mean 0.03
Std.Dev 0.02
Min 0.00
Q1 0.02
Median 0.03
Q3 0.04
Max 0.58
MAD 0.01
IQR 0.02
CV 0.54
Skewness 9.89
SE.Skewness 0.05
Kurtosis 256.68
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "mpepr",
    jitter = FALSE
  )
Figure 85: Histogram of the mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = maper_mpepr,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 55: Statistics for the maper_mpepr variable.
  maper_mpepr
Mean 0.06
Std.Dev 0.03
Min 0.00
Q1 0.04
Median 0.06
Q3 0.08
Max 0.59
MAD 0.02
IQR 0.03
CV 0.53
Skewness 3.61
SE.Skewness 0.05
Kurtosis 33.01
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "maper_mpepr",
    jitter = FALSE
  )
Figure 86: Histogram of the maper_mpepr variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = gdp_per_capita,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 56: Statistics for the gdp_per_capita variable.
  gdp_per_capita
Mean 11283.13
Std.Dev 14661.64
Min 1755.69
Q1 6088.96
Median 8357.51
Q3 12467.00
Max 291965.37
MAD 4242.41
IQR 6375.31
CV 1.30
Skewness 11.12
SE.Skewness 0.05
Kurtosis 172.80
N.Valid 2538.00
Pct.Valid 91.62

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "gdp_per_capita",
    jitter = FALSE
  )
Figure 87: Histogram of the gdp_per_capita variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Code
data_misfs_d |>
  summarytools::descr(
    var = spei_12m,
    style = "rmarkdown",
    plain.ascii = FALSE,
    headings = FALSE
  )
Table 57: Statistics for the spei_12m variable.
  spei_12m
Mean -0.24
Std.Dev 0.37
Min -1.75
Q1 -0.45
Median -0.21
Q3 0.02
Max 0.69
MAD 0.34
IQR 0.47
CV -1.54
Skewness -0.51
SE.Skewness 0.05
Kurtosis 0.28
N.Valid 2770.00
Pct.Valid 100.00

Source: Created by the authors.

Code
data_misfs_d |>
  plot_dist(
    col = "spei_12m",
    jitter = FALSE
  )
Figure 88: Histogram of the spei_12m variable with a kernel density estimate, a quantile-quantile (Q-Q) plot comparing the variable to the theoretical normal distribution, and a boxplot highlighting outliers in red.

Source: Created by the authors.

Checking Correlations

Code
data |>
  plot_ggally(
    cols = c("year", "misf", "sisvan_cover", "gdp_per_capita", "spei_12m"),
    mapping = ggplot2::aes(colour = misf)
  )
Figure 89: Correlation matrix of the secondary variables colored by the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) clusters.

Source: Created by the authors.

Code
data |>
  plot_ggally(
    cols = c(
      "year", "misf", "mbepr", "beipr", "mbepr_beipr", "gdp_per_capita",
      "spei_12m"
    ),
    mapping = ggplot2::aes(colour = misf)
  )
Figure 90: Correlation matrix of the stature variables colored by the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) clusters.

Source: Created by the authors.

Code
data |>
  plot_ggally(
    cols = c(
      "year", "misf", "maper",  "mpepr", "maper_mpepr", "gdp_per_capita",
      "spei_12m"
    ),
    mapping = ggplot2::aes(colour = misf)
  )
Figure 91: Correlation matrix of the thinness variables colored by the Revised Multidimensional Index for Sustainable Food Systems (MISFS-R) clusters.

Source: Created by the authors.

Modeling the Data

By s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re") (Continuous year)

Code
mbepr_gam_1 <- mgcv::gam(
  mbepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_1 |> summary()
#> 
#> Family: Beta regression(20.157) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.861140640  0.007939905 -360.3495 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.584178134271 8.951945 1024.44780 < 2.22e-16 ***
#> s(gdp_per_capita) 8.927964225397 8.998280 6041.29339 < 2.22e-16 ***
#> s(year)           0.000007753096 1.000000    0.00577 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0464   Deviance explained = 10.6%
#> -REML = -1.1166e+05  Scale est. = 1         n = 57487
Code
mbepr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 58: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_1 model.
Value Interpretation Rule
R2 0.0464015016 weak cohen1988
SE 0.0016397405 NA NA
Lower CI 0.0431876692 weak cohen1988
Upper CI 0.0496153339 weak cohen1988

Source: Created by the authors.

Code
mbepr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 59: Summary statistics of the mbepr_gam_1 model.
Value
df 18.5121501128
logLik 111724.8198784178
AIC -223409.7392750263
BIC -223230.9988001064
deviance 59164.5555004290
df.residual 57468.4878498872
nobs 57487.0000000000
adj.r.squared 0.0464015016
npar 20.0000000000

Source: Created by the authors.

Code
mbepr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 60: Value of the coefficients in the mbepr_gam_1 model.
Value
[Mean] -0.5258939556
(Intercept) -2.8611406401
mean(s(spei_12m)) -0.0490184501
mean(s(gdp_per_capita)) -0.8017302993
mean(s(year)) 0.0000002724

Source: Created by the authors.

Code
plot <- mbepr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)
#> Registered S3 method overwritten by 'mgcViz':
#>   method from  
#>   +.gg   GGally

for(i in plot$plots) print(i)
Figure 92: Effects of each term in the mbepr_gam_1 model.

Source: Created by the authors.

Code
mbepr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 8 iterations.
#> Gradient range [0.00000000006809441899,0.002879607161]
#> (score -111661.2122 & scale 1).
#> eigenvalue range [-0.002879561729,24562.5239].
#> Model rank =  20 / 20 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                           k'        edf k-index p-value
#> s(spei_12m)       9.00000000 8.58417813    1.00    0.69
#> s(gdp_per_capita) 9.00000000 8.92796423    1.03    0.98
#> s(year)           1.00000000 0.00000775    1.00    0.70
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 93: Diagnostics for the mbepr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 94: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_1 <- mgcv::gam(
  beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_1 |> summary()
#> 
#> Family: Beta regression(28.99) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.674224178  0.005226234 -511.6924 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.425216648125 8.910154  854.90605 < 2.22e-16 ***
#> s(gdp_per_capita) 8.947331900629 8.999076 5886.02651 < 2.22e-16 ***
#> s(year)           0.000004093323 1.000000    0.00483 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0711   Deviance explained =   10%
#> -REML = -1.0699e+05  Scale est. = 1         n = 57487
Code
beipr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 61: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_1 model.
Value Interpretation Rule
R2 0.0711058142 weak cohen1988
SE 0.0019772535 NA NA
Lower CI 0.0672304686 weak cohen1988
Upper CI 0.0749811599 weak cohen1988

Source: Created by the authors.

Code
beipr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 62: Summary statistics of the beipr_gam_1 model.
Value
df 18.3725526421
logLik 107054.6958721782
AIC -214069.6633168273
BIC -213891.6935860782
deviance 58610.8595242622
df.residual 57468.6274473579
nobs 57487.0000000000
adj.r.squared 0.0711058142
npar 20.0000000000

Source: Created by the authors.

Code
beipr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 63: Value of the coefficients in the beipr_gam_1 model.
Value
[Mean] -0.4755978616
(Intercept) -2.6742241784
mean(s(spei_12m)) -0.0967267012
mean(s(gdp_per_capita)) -0.6630214329
mean(s(year)) 0.0000001527

Source: Created by the authors.

Code
plot <- beipr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 95: Effects of each term in the beipr_gam_1 model.

Source: Created by the authors.

Code
beipr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 8 iterations.
#> Gradient range [-0.00000006091556815,0.002413588126]
#> (score -106990.7168 & scale 1).
#> eigenvalue range [-0.002413568672,26826.66028].
#> Model rank =  20 / 20 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                           k'        edf k-index p-value
#> s(spei_12m)       9.00000000 8.42521665    1.00    0.65
#> s(gdp_per_capita) 9.00000000 8.94733190    0.99    0.48
#> s(year)           1.00000000 0.00000409    0.99    0.53
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 96: Diagnostics for the beipr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 97: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_1 <- mgcv::gam(
  mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_1 |> summary()
#> 
#> Family: Beta regression(18.549) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.991809900  0.008055182 -247.2706 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.21138174291 8.835775  500.6104 < 2.22e-16 ***
#> s(gdp_per_capita) 8.95132416042 8.999211 6612.0255 < 2.22e-16 ***
#> s(year)           0.00001281605 1.000000    0.0069 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0928   Deviance explained =   11%
#> -REML = -75501  Scale est. = 1         n = 57487
Code
mbepr_beipr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 64: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_1 model.
Value Interpretation Rule
R2 0.0927744057 weak cohen1988
SE 0.0022058345 NA NA
Lower CI 0.0884510494 weak cohen1988
Upper CI 0.0970977620 weak cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 65: Summary statistics of the mbepr_beipr_gam_1 model.
Value
df 18.1627187194
logLik 75564.1684419054
AIC -151088.7545047294
BIC -150911.4390209391
deviance 56826.7250717344
df.residual 57468.8372812806
nobs 57487.0000000000
adj.r.squared 0.0927744057
npar 20.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 66: Value of the coefficients in the mbepr_beipr_gam_1 model.
Value
[Mean] -0.4327391520
(Intercept) -1.9918098995
mean(s(spei_12m)) -0.0491642639
mean(s(gdp_per_capita)) -0.6911661198
mean(s(year)) 0.0000003130

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 98: Effects of each term in the mbepr_beipr_gam_1 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 7 iterations.
#> Gradient range [-0.000000000002437161584,0.003442248851]
#> (score -75501.36548 & scale 1).
#> eigenvalue range [-0.0034421609,28216.20368].
#> Model rank =  20 / 20 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                          k'       edf k-index p-value  
#> s(spei_12m)       9.0000000 8.2113817    0.97   0.025 *
#> s(gdp_per_capita) 9.0000000 8.9513242    1.00   0.605  
#> s(year)           1.0000000 0.0000128    0.98   0.100 .
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 99: Diagnostics for the mbepr_beipr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 100: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_1 <- mgcv::gam(
  maper ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_1 |> summary()
#> 
#> Family: Beta regression(29.294) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.736553835  0.005585534 -668.9699 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.713679695384 8.976808 1763.49787 < 2.22e-16 ***
#> s(gdp_per_capita) 8.924353007769 8.998108 7582.65249 < 2.22e-16 ***
#> s(year)           0.000002266183 1.000000    0.00119 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0322   Deviance explained = 13.5%
#> -REML = -1.6507e+05  Scale est. = 1         n = 57487
Code
maper_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 67: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_1 model.
Value Interpretation Rule
R2 0.0322449945 weak cohen1988
SE 0.0013872034 NA NA
Lower CI 0.0295261259 weak cohen1988
Upper CI 0.0349638631 weak cohen1988

Source: Created by the authors.

Code
maper_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 68: Summary statistics of the maper_gam_1 model.
Value
df 18.6380349693
logLik 165139.1395496105
AIC -330238.3292586125
BIC -330059.3676731999
deviance 61134.5281416165
df.residual 57468.3619650307
nobs 57487.0000000000
adj.r.squared 0.0322449945
npar 20.0000000000

Source: Created by the authors.

Code
maper_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 69: Value of the coefficients in the maper_gam_1 model.
Value
[Mean] -0.6384154007
(Intercept) -3.7365538353
mean(s(spei_12m)) -0.0787088951
mean(s(gdp_per_capita)) -0.9248193552
mean(s(year)) 0.0000000731

Source: Created by the authors.

Code
plot <- maper_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 101: Effects of each term in the maper_gam_1 model.

Source: Created by the authors.

Code
maper_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.000004367680993,0.1862390108]
#> (score -165074.1951 & scale 1).
#> eigenvalue range [-0.0005940676576,20469.89394].
#> Model rank =  20 / 20 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                           k'        edf k-index p-value
#> s(spei_12m)       9.00000000 8.71367970    0.99    0.17
#> s(gdp_per_capita) 9.00000000 8.92435301    1.00    0.50
#> s(year)           1.00000000 0.00000227    0.98    0.11
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 102: Diagnostics for the maper_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 103: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_1 <- mgcv::gam(
  mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_1 |> summary()
#> 
#> Family: Beta regression(36.492) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -3.583160045  0.005421933 -660.864 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.745036118318 8.981492 2640.23084 < 2.22e-16 ***
#> s(gdp_per_capita) 8.931163034062 8.998426 7336.39793 < 2.22e-16 ***
#> s(year)           0.000002694927 1.000000    0.00239 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0261   Deviance explained =   14%
#> -REML = -1.5199e+05  Scale est. = 1         n = 57487
Code
mpepr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 70: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_1 model.
Value Interpretation Rule
R2 0.0260845253 weak cohen1988
SE 0.0012556144 NA NA
Lower CI 0.0236235663 weak cohen1988
Upper CI 0.0285454843 weak cohen1988

Source: Created by the authors.

Code
mpepr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 71: Summary statistics of the mpepr_gam_1 model.
Value
df 18.6762018473
logLik 152056.3826799541
AIC -304072.8055124315
BIC -303893.7990996807
deviance 61556.6647899098
df.residual 57468.3237981527
nobs 57487.0000000000
adj.r.squared 0.0260845253
npar 20.0000000000

Source: Created by the authors.

Code
mpepr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 72: Value of the coefficients in the mpepr_gam_1 model.
Value
[Mean] -0.5808609872
(Intercept) -3.5831600449
mean(s(spei_12m)) -0.0478663971
mean(s(gdp_per_capita)) -0.8448069142
mean(s(year)) 0.0000001039

Source: Created by the authors.

Code
plot <- mpepr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 104: Effects of each term in the mpepr_gam_1 model.

Source: Created by the authors.

Code
mpepr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.000002371916537,0.06498952371]
#> (score -151990.3073 & scale 1).
#> eigenvalue range [-0.001191916298,23090.53243].
#> Model rank =  20 / 20 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                           k'        edf k-index p-value
#> s(spei_12m)       9.00000000 8.74503612    0.99    0.42
#> s(gdp_per_capita) 9.00000000 8.93116303    0.99    0.27
#> s(year)           1.00000000 0.00000269    0.98    0.10
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 105: Diagnostics for the mpepr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 106: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_1 <- mgcv::gam(
  maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_1 |> summary()
#> 
#> Family: Beta regression(24.441) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.927179429  0.005399655 -542.1049 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df     Chi.sq    p-value    
#> s(spei_12m)       8.767998714279 8.984645 1966.20975 < 2.22e-16 ***
#> s(gdp_per_capita) 8.927338038815 8.998253 8023.77308 < 2.22e-16 ***
#> s(year)           0.000003094706 1.000000    0.00133 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0597   Deviance explained = 14.6%
#> -REML = -1.1628e+05  Scale est. = 1         n = 57487
Code
maper_mpepr_gam_1 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 73: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_1 model.
Value Interpretation Rule
R2 0.0596743943 weak cohen1988
SE 0.0018336474 NA NA
Lower CI 0.0560805115 weak cohen1988
Upper CI 0.0632682771 weak cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_1 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 74: Summary statistics of the maper_mpepr_gam_1 model.
Value
df 18.6953398478
logLik 116347.2518000684
AIC -232654.5377929083
BIC -232475.5046825131
deviance 59538.9739075563
df.residual 57468.3046601522
nobs 57487.0000000000
adj.r.squared 0.0596743943
npar 20.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_1 |>
  summarise_coefs() |>
  md_named_tibble()
Table 75: Value of the coefficients in the maper_mpepr_gam_1 model.
Value
[Mean] -0.5164756841
(Intercept) -2.9271794294
mean(s(spei_12m)) -0.0129632359
mean(s(gdp_per_capita)) -0.8095183564
mean(s(year)) 0.0000000792

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_1 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 107: Effects of each term in the maper_mpepr_gam_1 model.

Source: Created by the authors.

Code
maper_mpepr_gam_1 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.0000000180332842,0.0006629463672]
#> (score -116280.8774 & scale 1).
#> eigenvalue range [-0.0006629420942,25021.01371].
#> Model rank =  20 / 20 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                           k'        edf k-index p-value  
#> s(spei_12m)       9.00000000 8.76799871    1.00   0.750  
#> s(gdp_per_capita) 9.00000000 8.92733804    0.99   0.430  
#> s(year)           1.00000000 0.00000309    0.97   0.075 .
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 108: Diagnostics for the maper_mpepr_gam_1 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_1,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 109: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_1 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + s(gdp_per_capita) + year (Ordered year)

In this model, the year variable is treated as a ordered categorical variable.

.L, .Q, and .C are, respectively, the coefficients for the ordered factor coded with linear, quadratic, and cubic contrasts.

Code
mbepr_gam_2 <- mgcv::gam(
  mbepr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_2 |> summary()
#> 
#> Family: Beta regression(20.626) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.867236822  0.003281149 -873.85133 < 2.22e-16 ***
#> year.L       0.334852405  0.015304979   21.87866 < 2.22e-16 ***
#> year.Q      -0.190191728  0.011293836  -16.84031 < 2.22e-16 ***
#> year.C       0.029166943  0.011042189    2.64141 0.00825618 ** 
#> year^4      -0.034744005  0.010994303   -3.16018 0.00157670 ** 
#> year^5       0.065036783  0.011586423    5.61319 1.9863e-08 ***
#> year^6      -0.090152964  0.011470716   -7.85940 3.8597e-15 ***
#> year^7       0.037891711  0.011064506    3.42462 0.00061566 ***
#> year^8       0.083305795  0.011312349    7.36415 1.7828e-13 ***
#> year^9      -0.101055623  0.011498195   -8.78882 < 2.22e-16 ***
#> year^10     -0.005261888  0.010895385   -0.48295 0.62913371    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.590172 8.953754  260.0321 < 2.22e-16 ***
#> s(gdp_per_capita) 8.948270 8.999109 6695.3422 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0361   Deviance explained = 12.6%
#> -REML = -1.1223e+05  Scale est. = 1         n = 57487
Code
mbepr_gam_2 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 76: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_2 model.
Value Interpretation Rule
R2 0.0361097497 weak cohen1988
SE 0.0014621212 NA NA
Lower CI 0.0332440448 weak cohen1988
Upper CI 0.0389754546 weak cohen1988

Source: Created by the authors.

Code
mbepr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 77: Summary statistics of the mbepr_gam_2 model.
Value
df 28.5384421900
logLik 112328.7929502070
AIC -224597.6801733562
BIC -224329.3230603794
deviance 59160.0001780340
df.residual 57458.4615578100
nobs 57487.0000000000
adj.r.squared 0.0361097497
npar 29.0000000000

Source: Created by the authors.

Code
mbepr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 78: Value of the coefficients in the mbepr_gam_2 model.
Value
[Mean] -0.3903238155
(Intercept) -2.8672368221
year.L 0.3348524054
year.Q -0.1901917275
year.C 0.0291669434
year^4 -0.0347440046
year^5 0.0650367833
year^6 -0.0901529636
year^7 0.0378917115
year^8 0.0833057953
year^9 -0.1010556227
year^10 -0.0052618883
mean(s(spei_12m)) -0.0268823140
mean(s(gdp_per_capita)) -0.9265622705

Source: Created by the authors.

Code
plot <- mbepr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 110: Effects of each term in the mbepr_gam_2 model.

Source: Created by the authors.

Code
mbepr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.000000007553492054,0.0001310561186]
#> (score -112228.2713 & scale 1).
#> Hessian positive definite, eigenvalue range [2.742501638,24607.56655].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 8.59    0.98    0.10
#> s(gdp_per_capita) 9.00 8.95    0.99    0.27
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 111: Diagnostics for the mbepr_gam_2 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 112: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_2 <- mgcv::gam(
  beipr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_2 |> summary()
#> 
#> Family: Beta regression(29.757) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.679556058  0.002762283 -970.05121 < 2.22e-16 ***
#> year.L       0.379363757  0.012844958   29.53406 < 2.22e-16 ***
#> year.Q      -0.073493595  0.009454281   -7.77358 7.6299e-15 ***
#> year.C      -0.017737994  0.009260560   -1.91543  0.0554371 .  
#> year^4      -0.018744860  0.009205861   -2.03619  0.0417315 *  
#> year^5       0.040090504  0.009720607    4.12428 3.7190e-05 ***
#> year^6      -0.088111561  0.009657780   -9.12338 < 2.22e-16 ***
#> year^7       0.005715029  0.009274683    0.61620  0.5377647    
#> year^8       0.063706394  0.009575102    6.65334 2.8652e-11 ***
#> year^9      -0.031224094  0.009720235   -3.21228  0.0013169 ** 
#> year^10      0.053974600  0.009221093    5.85338 4.8167e-09 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.087818 8.785738  129.7223 < 2.22e-16 ***
#> s(gdp_per_capita) 8.963470 8.999553 6882.1263 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0631   Deviance explained = 12.3%
#> -REML = -1.0766e+05  Scale est. = 1         n = 57487
Code
beipr_gam_2 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 79: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_2 model.
Value Interpretation Rule
R2 0.0631125811 weak cohen1988
SE 0.0018788362 NA NA
Lower CI 0.0594301298 weak cohen1988
Upper CI 0.0667950325 weak cohen1988

Source: Created by the authors.

Code
beipr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 80: Summary statistics of the beipr_gam_2 model.
Value
df 28.0512885520
logLik 107759.0063622705
AIC -215458.5539124896
BIC -215192.1988254745
deviance 58635.8529103905
df.residual 57458.9487114480
nobs 57487.0000000000
adj.r.squared 0.0631125811
npar 29.0000000000

Source: Created by the authors.

Code
beipr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 81: Value of the coefficients in the beipr_gam_2 model.
Value
[Mean] -0.3476178903
(Intercept) -2.6795560580
year.L 0.3793637569
year.Q -0.0734935948
year.C -0.0177379944
year^4 -0.0187448596
year^5 0.0400905045
year^6 -0.0881115613
year^7 0.0057150295
year^8 0.0637063939
year^9 -0.0312240945
year^10 0.0539745997
mean(s(spei_12m)) -0.0761424849
mean(s(gdp_per_capita)) -0.7810687308

Source: Created by the authors.

Code
plot <- beipr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 113: Effects of each term in the beipr_gam_2 model.

Source: Created by the authors.

Code
beipr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.00000007628327259,0.0008694519884]
#> (score -107658.5489 & scale 1).
#> Hessian positive definite, eigenvalue range [2.587987234,26850.58834].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 8.09    0.99    0.34
#> s(gdp_per_capita) 9.00 8.96    0.97    0.12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 114: Diagnostics for the beipr_gam_2 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 115: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_2 <- mgcv::gam(
  mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_2 |> summary()
#> 
#> Family: Beta regression(18.821) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -1.993982846  0.002685691 -742.44691         < 2.22e-16 ***
#> year.L       0.232091903  0.012477038   18.60152         < 2.22e-16 ***
#> year.Q      -0.081556995  0.009207992   -8.85720         < 2.22e-16 ***
#> year.C       0.006303070  0.009022933    0.69856          0.4848264    
#> year^4      -0.017902893  0.008971719   -1.99548          0.0459905 *  
#> year^5       0.053929139  0.009480922    5.68817 0.0000000128404427 ***
#> year^6      -0.092038681  0.009401276   -9.79002         < 2.22e-16 ***
#> year^7       0.028252073  0.009056075    3.11968          0.0018105 ** 
#> year^8       0.064366668  0.009298415    6.92233 0.0000000000044429 ***
#> year^9      -0.050756320  0.009473928   -5.35747 0.0000000843935688 ***
#> year^10      0.013876154  0.008985835    1.54423          0.1225338    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.619617 8.538673  121.8412 < 2.22e-16 ***
#> s(gdp_per_capita) 8.962548 8.999531 6728.9094 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0903   Deviance explained = 12.2%
#> -REML = -75868  Scale est. = 1         n = 57487
Code
mbepr_beipr_gam_2 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 82: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_2 model.
Value Interpretation Rule
R2 0.0902584119 weak cohen1988
SE 0.0021817523 NA NA
Lower CI 0.0859822559 weak cohen1988
Upper CI 0.0945345678 weak cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 83: Summary statistics of the mbepr_beipr_gam_2 model.
Value
df 27.5821646294
logLik 75966.5942130830
AIC -151874.1120177856
BIC -151609.4699680741
deviance 56843.8939035914
df.residual 57459.4178353706
nobs 57487.0000000000
adj.r.squared 0.0902584119
npar 29.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 84: Value of the coefficients in the mbepr_beipr_gam_2 model.
Value
[Mean] -0.3148429005
(Intercept) -1.9939828463
year.L 0.2320919026
year.Q -0.0815569951
year.C 0.0063030698
year^4 -0.0179028932
year^5 0.0539291385
year^6 -0.0920386810
year^7 0.0282520728
year^8 0.0643666680
year^9 -0.0507563198
year^10 0.0138761538
mean(s(spei_12m)) -0.0366551981
mean(s(gdp_per_capita)) -0.7736809556

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 116: Effects of each term in the mbepr_beipr_gam_2 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 8 iterations.
#> Gradient range [-0.0001292059854,0.0003324223279]
#> (score -75868.16565 & scale 1).
#> Hessian positive definite, eigenvalue range [1.430426406,28213.15345].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 7.62    0.98    0.27
#> s(gdp_per_capita) 9.00 8.96    1.00    0.66
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 117: Diagnostics for the mbepr_beipr_gam_2 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 118: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_2 <- mgcv::gam(
  maper ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_2 |> summary()
#> 
#> Family: Beta regression(30.068) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error     z value          Pr(>|z|)    
#> (Intercept) -3.745811394  0.003590307 -1043.31227        < 2.22e-16 ***
#> year.L       0.284451962  0.016747863    16.98437        < 2.22e-16 ***
#> year.Q      -0.252746696  0.012370422   -20.43153        < 2.22e-16 ***
#> year.C      -0.041954809  0.012055881    -3.48003        0.00050136 ***
#> year^4      -0.041283859  0.012062966    -3.42236        0.00062079 ***
#> year^5       0.078841216  0.012725742     6.19541 0.000000000581327 ***
#> year^6      -0.047537107  0.012600461    -3.77265        0.00016152 ***
#> year^7       0.079219649  0.012084358     6.55555 0.000000000055436 ***
#> year^8       0.152385939  0.012355872    12.33308        < 2.22e-16 ***
#> year^9      -0.126937979  0.012528186   -10.13219        < 2.22e-16 ***
#> year^10      0.066201041  0.011916908     5.55522 0.000000027726284 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.694710 8.973967  664.9771 < 2.22e-16 ***
#> s(gdp_per_capita) 8.944671 8.998983 7907.9297 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0196   Deviance explained = 15.5%
#> -REML = -1.6567e+05  Scale est. = 1         n = 57487
Code
maper_gam_2 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 85: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_2 model.
Value Interpretation Rule
R2 0.0195525479 very weak (negligible) cohen1988
SE 0.0010943835 NA NA
Lower CI 0.0174075956 very weak (negligible) cohen1988
Upper CI 0.0216975002 weak cohen1988

Source: Created by the authors.

Code
maper_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 86: Summary statistics of the maper_gam_2 model.
Value
df 28.6393814172
logLik 165771.6188545156
AIC -331483.2918093859
BIC -331214.7547369934
deviance 61106.8873587711
df.residual 57458.3606185828
nobs 57487.0000000000
adj.r.squared 0.0195525479
npar 29.0000000000

Source: Created by the authors.

Code
maper_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 87: Value of the coefficients in the maper_gam_2 model.
Value
[Mean] -0.4669379494
(Intercept) -3.7458113944
year.L 0.2844519617
year.Q -0.2527466962
year.C -0.0419548095
year^4 -0.0412838591
year^5 0.0788412155
year^6 -0.0475371072
year^7 0.0792196494
year^8 0.1523859391
year^9 -0.1269379792
year^10 0.0662010413
mean(s(spei_12m)) -0.0515535149
mean(s(gdp_per_capita)) -1.0535607621

Source: Created by the authors.

Code
plot <- maper_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 119: Effects of each term in the maper_gam_2 model.

Source: Created by the authors.

Code
maper_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.000002867504815,0.1272252185]
#> (score -165671.0735 & scale 1).
#> Hessian positive definite, eigenvalue range [3.108890111,20555.5479].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 8.69       1    0.45
#> s(gdp_per_capita) 9.00 8.94       1    0.56
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 120: Diagnostics for the maper_gam_2 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 121: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_2 <- mgcv::gam(
  mpepr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_2 |> summary()
#> 
#> Family: Beta regression(37.457) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error     z value            Pr(>|z|)    
#> (Intercept) -3.591069631  0.003307189 -1085.83751          < 2.22e-16 ***
#> year.L       0.367855057  0.015442503    23.82095          < 2.22e-16 ***
#> year.Q      -0.159533870  0.011391553   -14.00458          < 2.22e-16 ***
#> year.C      -0.037310268  0.011039591    -3.37968          0.00072571 ***
#> year^4      -0.112980560  0.011066570   -10.20918          < 2.22e-16 ***
#> year^5       0.039551972  0.011649005     3.39531          0.00068551 ***
#> year^6      -0.017942377  0.011542848    -1.55442          0.12008545    
#> year^7       0.035718527  0.011057339     3.23030          0.00123660 ** 
#> year^8       0.118922709  0.011338117    10.48875          < 2.22e-16 ***
#> year^9      -0.079238108  0.011493850    -6.89396 0.00000000000542614 ***
#> year^10      0.079527906  0.011014548     7.22026 0.00000000000051888 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.647503 8.965450  822.0245 < 2.22e-16 ***
#> s(gdp_per_capita) 8.951176 8.999205 7986.3431 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00384   Deviance explained = 16.1%
#> -REML = -1.5263e+05  Scale est. = 1         n = 57487
Code
mpepr_gam_2 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 88: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_2 model.
Value Interpretation Rule
R2 0.0038386871 very weak (negligible) cohen1988
SE 0.0004926796 NA NA
Lower CI 0.0028730528 very weak (negligible) cohen1988
Upper CI 0.0048043214 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mpepr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 89: Summary statistics of the mpepr_gam_2 model.
Value
df 28.5986793746
logLik 152726.7044215834
AIC -305393.4795328694
BIC -305125.0167750669
deviance 61538.8824296959
df.residual 57458.4013206254
nobs 57487.0000000000
adj.r.squared 0.0038386871
npar 29.0000000000

Source: Created by the authors.

Code
mpepr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 90: Value of the coefficients in the mpepr_gam_2 model.
Value
[Mean] -0.4291351369
(Intercept) -3.5910696309
year.L 0.3678550569
year.Q -0.1595338697
year.C -0.0373102681
year^4 -0.1129805604
year^5 0.0395519722
year^6 -0.0179423769
year^7 0.0357185269
year^8 0.1189227087
year^9 -0.0792381076
year^10 0.0795279064
mean(s(spei_12m)) -0.0288333047
mean(s(gdp_per_capita)) -0.9809911760

Source: Created by the authors.

Code
plot <- mpepr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 122: Effects of each term in the mpepr_gam_2 model.

Source: Created by the authors.

Code
mpepr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [-0.00001519267452,0.03105131545]
#> (score -152625.1651 & scale 1).
#> Hessian positive definite, eigenvalue range [2.990365667,23167.47384].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value  
#> s(spei_12m)       9.00 8.65    0.98    0.09 .
#> s(gdp_per_capita) 9.00 8.95    1.01    0.82  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 123: Diagnostics for the mpepr_gam_2 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 124: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_2 <- mgcv::gam(
  maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_2 |> summary()
#> 
#> Family: Beta regression(24.906) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.932009662  0.003154015 -929.61194 < 2.22e-16 ***
#> year.L       0.225931702  0.014735767   15.33220 < 2.22e-16 ***
#> year.Q      -0.170620538  0.010860320  -15.71045 < 2.22e-16 ***
#> year.C      -0.045362482  0.010532400   -4.30695 1.6552e-05 ***
#> year^4      -0.086231457  0.010553933   -8.17055 3.0698e-16 ***
#> year^5       0.061553065  0.011116860    5.53691 3.0785e-08 ***
#> year^6      -0.015874857  0.011008964   -1.44199     0.1493    
#> year^7       0.077181524  0.010556785    7.31108 2.6500e-13 ***
#> year^8       0.119533798  0.010806315   11.06148 < 2.22e-16 ***
#> year^9      -0.079353515  0.010970747   -7.23319 4.7177e-13 ***
#> year^10      0.057858181  0.010478759    5.52147 3.3617e-08 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.739492 8.980914  782.5095 < 2.22e-16 ***
#> s(gdp_per_capita) 8.945937 8.999029 7854.0728 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0487   Deviance explained = 16.1%
#> -REML = -1.1674e+05  Scale est. = 1         n = 57487
Code
maper_mpepr_gam_2 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 91: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_2 model.
Value Interpretation Rule
R2 0.0487055780 weak cohen1988
SE 0.0016758990 NA NA
Lower CI 0.0454208762 weak cohen1988
Upper CI 0.0519902797 weak cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_2 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 92: Summary statistics of the maper_mpepr_gam_2 model.
Value
df 28.685429756
logLik 116845.724333434
AIC -233631.488781632
BIC -233362.889058592
deviance 59536.185150791
df.residual 57458.314570244
nobs 57487.000000000
adj.r.squared 0.048705578
npar 29.000000000

Source: Created by the authors.

Code
maper_mpepr_gam_2 |>
  summarise_coefs() |>
  md_named_tibble()
Table 93: Value of the coefficients in the maper_mpepr_gam_2 model.
Value
[Mean] -0.3774149887
(Intercept) -2.9320096620
year.L 0.2259317019
year.Q -0.1706205382
year.C -0.0453624821
year^4 -0.0862314575
year^5 0.0615530651
year^6 -0.0158748575
year^7 0.0771815244
year^8 0.1195337978
year^9 -0.0793535149
year^10 0.0578581812
mean(s(spei_12m)) 0.0017632820
mean(s(gdp_per_capita)) -0.9081677744

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_2 |>  mgcViz::getViz() |> plot(allTerms = TRUE)

for(i in plot$plots) print(i)
Figure 125: Effects of each term in the maper_mpepr_gam_2 model.

Source: Created by the authors.

Code
maper_mpepr_gam_2 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.000000006063582525,0.0004676518962]
#> (score -116742.6877 & scale 1).
#> Hessian positive definite, eigenvalue range [3.173550905,25060.67586].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 8.74       1    0.81
#> s(gdp_per_capita) 9.00 8.95       1    0.80
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 126: Diagnostics for the maper_mpepr_gam_2 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_2,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 127: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_2 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + s(gdp_per_capita) + year (Unordered year)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_3 <- mgcv::gam(
  mbepr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_3 |> summary()
#> 
#> Family: Beta regression(20.626) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.17751855  0.01264439 -251.29862 < 2.22e-16 ***
#> year2009     0.21946564  0.01606210   13.66357 < 2.22e-16 ***
#> year2011     0.26972212  0.01595683   16.90324 < 2.22e-16 ***
#> year2012     0.16521320  0.01756187    9.40749 < 2.22e-16 ***
#> year2013     0.37280450  0.01608782   23.17309 < 2.22e-16 ***
#> year2014     0.43539213  0.01645695   26.45643 < 2.22e-16 ***
#> year2015     0.34933198  0.01765053   19.79158 < 2.22e-16 ***
#> year2016     0.41030039  0.01827290   22.45404 < 2.22e-16 ***
#> year2017     0.41180257  0.01779022   23.14769 < 2.22e-16 ***
#> year2018     0.39845137  0.01772076   22.48500 < 2.22e-16 ***
#> year2019     0.38061511  0.01832153   20.77420 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.590172 8.953754  260.0321 < 2.22e-16 ***
#> s(gdp_per_capita) 8.948270 8.999109 6695.3422 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0361   Deviance explained = 12.6%
#> -REML = -1.1223e+05  Scale est. = 1         n = 57487
Code
mbepr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 94: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_3 model.
Value Interpretation Rule
R2 0.0361097497 weak cohen1988
SE 0.0014621212 NA NA
Lower CI 0.0332440448 weak cohen1988
Upper CI 0.0389754546 weak cohen1988

Source: Created by the authors.

Code
mbepr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 95: Summary statistics of the mbepr_gam_3 model.
Value
df 28.5384421900
logLik 112328.7929502070
AIC -224597.6801733562
BIC -224329.3230603794
deviance 59160.0001780340
df.residual 57458.4615578100
nobs 57487.0000000000
adj.r.squared 0.0361097497
npar 29.0000000000

Source: Created by the authors.

Code
mbepr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 96: Value of the coefficients in the mbepr_gam_3 model.
Value
[Mean] -0.2877731315
(Intercept) -3.1775185491
year2009 0.2194656411
year2011 0.2697221198
year2012 0.1652131985
year2013 0.3728045007
year2014 0.4353921284
year2015 0.3493319752
year2016 0.4103003866
year2017 0.4118025670
year2018 0.3984513695
year2019 0.3806151101
mean(s(spei_12m)) -0.0268823140
mean(s(gdp_per_capita)) -0.9265622705

Source: Created by the authors.

Code
plot <- mbepr_gam_3 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 128: Effects of each term in the mbepr_gam_3 model.

Source: Created by the authors.

Code
mbepr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.000000007552963588,0.0001310561095]
#> (score -112229.4703 & scale 1).
#> Hessian positive definite, eigenvalue range [2.742501638,24607.56655].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 8.59    1.00    0.51
#> s(gdp_per_capita) 9.00 8.95    0.99    0.30
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 129: Diagnostics for the mbepr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 130: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_3 <- mgcv::gam(
  beipr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_3 |> summary()
#> 
#> Family: Beta regression(29.757) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value      Pr(>|z|)    
#> (Intercept) -2.91671409  0.01058283 -275.60826    < 2.22e-16 ***
#> year2009     0.12774769  0.01345866    9.49186    < 2.22e-16 ***
#> year2011     0.15064247  0.01342023   11.22503    < 2.22e-16 ***
#> year2012     0.07558004  0.01481980    5.09994 0.00000033977 ***
#> year2013     0.24903905  0.01351495   18.42693    < 2.22e-16 ***
#> year2014     0.28428158  0.01387911   20.48269    < 2.22e-16 ***
#> year2015     0.32345451  0.01474256   21.94019    < 2.22e-16 ***
#> year2016     0.28846946  0.01539833   18.73381    < 2.22e-16 ***
#> year2017     0.36147514  0.01485394   24.33531    < 2.22e-16 ***
#> year2018     0.38314312  0.01476064   25.95709    < 2.22e-16 ***
#> year2019     0.36490532  0.01528446   23.87427    < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.087818 8.785738  129.7223 < 2.22e-16 ***
#> s(gdp_per_capita) 8.963470 8.999553 6882.1263 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0631   Deviance explained = 12.3%
#> -REML = -1.0766e+05  Scale est. = 1         n = 57487
Code
beipr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 97: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_3 model.
Value Interpretation Rule
R2 0.0631125811 weak cohen1988
SE 0.0018788362 NA NA
Lower CI 0.0594301298 weak cohen1988
Upper CI 0.0667950325 weak cohen1988

Source: Created by the authors.

Code
beipr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 98: Summary statistics of the beipr_gam_3 model.
Value
df 28.0512885520
logLik 107759.0063622698
AIC -215458.5539124882
BIC -215192.1988254731
deviance 58635.8529103912
df.residual 57458.9487114480
nobs 57487.0000000000
adj.r.squared 0.0631125811
npar 29.0000000000

Source: Created by the authors.

Code
beipr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 99: Value of the coefficients in the beipr_gam_3 model.
Value
[Mean] -0.2766509191
(Intercept) -2.9167140924
year2009 0.1277476919
year2011 0.1506424680
year2012 0.0755800367
year2013 0.2490390471
year2014 0.2842815840
year2015 0.3234545123
year2016 0.2884694561
year2017 0.3614751356
year2018 0.3831431248
year2019 0.3649053222
mean(s(spei_12m)) -0.0761424849
mean(s(gdp_per_capita)) -0.7810687308

Source: Created by the authors.

Code
plot <- beipr_gam_3 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 131: Effects of each term in the beipr_gam_3 model.

Source: Created by the authors.

Code
beipr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.00000007628265752,0.0008694512423]
#> (score -107659.7478 & scale 1).
#> Hessian positive definite, eigenvalue range [2.587987234,26850.58834].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value  
#> s(spei_12m)       9.00 8.09    0.96    0.03 *
#> s(gdp_per_capita) 9.00 8.96    0.97    0.07 .
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 132: Diagnostics for the beipr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 133: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_3 <- mgcv::gam(
  mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_3 |> summary()
#> 
#> Family: Beta regression(18.821) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value    Pr(>|z|)    
#> (Intercept) -2.18114506  0.01018210 -214.21360  < 2.22e-16 ***
#> year2009     0.14925652  0.01295454   11.52156  < 2.22e-16 ***
#> year2011     0.14163298  0.01292342   10.95940  < 2.22e-16 ***
#> year2012     0.06000637  0.01428716    4.20002 0.000026689 ***
#> year2013     0.21463584  0.01306667   16.42621  < 2.22e-16 ***
#> year2014     0.26260938  0.01340196   19.59485  < 2.22e-16 ***
#> year2015     0.22481585  0.01434108   15.67636  < 2.22e-16 ***
#> year2016     0.22643036  0.01491051   15.18596  < 2.22e-16 ***
#> year2017     0.26048463  0.01444929   18.02750  < 2.22e-16 ***
#> year2018     0.26291844  0.01438755   18.27403  < 2.22e-16 ***
#> year2019     0.25599396  0.01487603   17.20849  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.619617 8.538673  121.8412 < 2.22e-16 ***
#> s(gdp_per_capita) 8.962548 8.999531 6728.9094 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0903   Deviance explained = 12.2%
#> -REML = -75869  Scale est. = 1         n = 57487
Code
mbepr_beipr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 100: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_3 model.
Value Interpretation Rule
R2 0.0902584119 weak cohen1988
SE 0.0021817523 NA NA
Lower CI 0.0859822559 weak cohen1988
Upper CI 0.0945345678 weak cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 101: Summary statistics of the mbepr_beipr_gam_3 model.
Value
df 27.5821646294
logLik 75966.5942130833
AIC -151874.1120177862
BIC -151609.4699680747
deviance 56843.8939035902
df.residual 57459.4178353706
nobs 57487.0000000000
adj.r.squared 0.0902584119
npar 29.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 102: Value of the coefficients in the mbepr_beipr_gam_3 model.
Value
[Mean] -0.2557029687
(Intercept) -2.1811450599
year2009 0.1492565233
year2011 0.1416329845
year2012 0.0600063687
year2013 0.2146358442
year2014 0.2626093801
year2015 0.2248158540
year2016 0.2264303616
year2017 0.2604846318
year2018 0.2629184427
year2019 0.2559939591
mean(s(spei_12m)) -0.0366551981
mean(s(gdp_per_capita)) -0.7736809556

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_3 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 134: Effects of each term in the mbepr_beipr_gam_3 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 8 iterations.
#> Gradient range [-0.0001292059843,0.0003324216679]
#> (score -75869.3646 & scale 1).
#> Hessian positive definite, eigenvalue range [1.430426406,28213.15345].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 7.62    0.99     0.4
#> s(gdp_per_capita) 9.00 8.96    1.00     0.7
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 135: Diagnostics for the mbepr_beipr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 136: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_3 <- mgcv::gam(
  maper ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_3 |> summary()
#> 
#> Family: Beta regression(30.068) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value     Pr(>|z|)    
#> (Intercept) -4.03156418  0.01371885 -293.87048   < 2.22e-16 ***
#> year2009     0.18134814  0.01763039   10.28611   < 2.22e-16 ***
#> year2011     0.27855200  0.01740199   16.00690   < 2.22e-16 ***
#> year2012     0.08872108  0.01911000    4.64265 0.0000034396 ***
#> year2013     0.40296993  0.01748521   23.04634   < 2.22e-16 ***
#> year2014     0.40124539  0.01802165   22.26463   < 2.22e-16 ***
#> year2015     0.35389354  0.01918292   18.44836   < 2.22e-16 ***
#> year2016     0.39620418  0.01989293   19.91683   < 2.22e-16 ***
#> year2017     0.46231172  0.01927478   23.98532   < 2.22e-16 ***
#> year2018     0.29859262  0.01940672   15.38604   < 2.22e-16 ***
#> year2019     0.27944209  0.02004991   13.93732   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.694710 8.973967  664.9771 < 2.22e-16 ***
#> s(gdp_per_capita) 8.944671 8.998983 7907.9297 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0196   Deviance explained = 15.5%
#> -REML = -1.6567e+05  Scale est. = 1         n = 57487
Code
maper_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 103: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_3 model.
Value Interpretation Rule
R2 0.0195525479 very weak (negligible) cohen1988
SE 0.0010943835 NA NA
Lower CI 0.0174075956 very weak (negligible) cohen1988
Upper CI 0.0216975002 weak cohen1988

Source: Created by the authors.

Code
maper_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 104: Summary statistics of the maper_gam_3 model.
Value
df 28.6393814172
logLik 165771.6188545161
AIC -331483.2918093869
BIC -331214.7547369944
deviance 61106.8873587697
df.residual 57458.3606185828
nobs 57487.0000000000
adj.r.squared 0.0195525479
npar 29.0000000000

Source: Created by the authors.

Code
maper_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 105: Value of the coefficients in the maper_gam_3 model.
Value
[Mean] -0.3735969657
(Intercept) -4.0315641827
year2009 0.1813481356
year2011 0.2785519963
year2012 0.0887210850
year2013 0.4029699259
year2014 0.4012453852
year2015 0.3538935373
year2016 0.3962041771
year2017 0.4623117250
year2018 0.2985926161
year2019 0.2794420880
mean(s(spei_12m)) -0.0515535149
mean(s(gdp_per_capita)) -1.0535607621

Source: Created by the authors.

Code
plot <- maper_gam_3 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 137: Effects of each term in the maper_gam_3 model.

Source: Created by the authors.

Code
maper_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.000002867503382,0.127225218]
#> (score -165672.2724 & scale 1).
#> Hessian positive definite, eigenvalue range [3.108890111,20555.5479].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value
#> s(spei_12m)       9.00 8.69    1.01    0.83
#> s(gdp_per_capita) 9.00 8.94    1.00    0.67
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 138: Diagnostics for the maper_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 139: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_3 <- mgcv::gam(
  mpepr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_3 |> summary()
#> 
#> Family: Beta regression(37.457) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value          Pr(>|z|)    
#> (Intercept) -3.88113475  0.01274667 -304.48226        < 2.22e-16 ***
#> year2009     0.16202699  0.01633782    9.91730        < 2.22e-16 ***
#> year2011     0.28188199  0.01608819   17.52105        < 2.22e-16 ***
#> year2012     0.11860212  0.01763071    6.72702 0.000000000017317 ***
#> year2013     0.33552317  0.01624424   20.65490        < 2.22e-16 ***
#> year2014     0.31509842  0.01677777   18.78071        < 2.22e-16 ***
#> year2015     0.35076953  0.01772842   19.78571        < 2.22e-16 ***
#> year2016     0.38552502  0.01837166   20.98477        < 2.22e-16 ***
#> year2017     0.50147159  0.01769887   28.33354        < 2.22e-16 ***
#> year2018     0.40074422  0.01779105   22.52505        < 2.22e-16 ***
#> year2019     0.33907330  0.01845077   18.37719        < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.647503 8.965450  822.0245 < 2.22e-16 ***
#> s(gdp_per_capita) 8.951176 8.999205 7986.3431 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00384   Deviance explained = 16.1%
#> -REML = -1.5263e+05  Scale est. = 1         n = 57487
Code
mpepr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 106: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_3 model.
Value Interpretation Rule
R2 0.0038386871 very weak (negligible) cohen1988
SE 0.0004926796 NA NA
Lower CI 0.0028730528 very weak (negligible) cohen1988
Upper CI 0.0048043214 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mpepr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 107: Summary statistics of the mpepr_gam_3 model.
Value
df 28.5986793746
logLik 152726.7044215837
AIC -305393.4795328700
BIC -305125.0167750675
deviance 61538.8824296946
df.residual 57458.4013206254
nobs 57487.0000000000
adj.r.squared 0.0038386871
npar 29.0000000000

Source: Created by the authors.

Code
mpepr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 108: Value of the coefficients in the mpepr_gam_3 model.
Value
[Mean] -0.3372013358
(Intercept) -3.8811347527
year2009 0.1620269881
year2011 0.2818819858
year2012 0.1186021185
year2013 0.3355231690
year2014 0.3150984234
year2015 0.3507695348
year2016 0.3855250165
year2017 0.5014715862
year2018 0.4007442183
year2019 0.3390733003
mean(s(spei_12m)) -0.0288333047
mean(s(gdp_per_capita)) -0.9809911760

Source: Created by the authors.

Code
plot <- mpepr_gam_3 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 140: Effects of each term in the mpepr_gam_3 model.

Source: Created by the authors.

Code
mpepr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [-0.00001519267568,0.03105131563]
#> (score -152626.3641 & scale 1).
#> Hessian positive definite, eigenvalue range [2.990365667,23167.47384].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value  
#> s(spei_12m)       9.00 8.65    0.98   0.095 .
#> s(gdp_per_capita) 9.00 8.95    0.98   0.125  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 141: Diagnostics for the mpepr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 142: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_3 <- mgcv::gam(
  maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_3 |> summary()
#> 
#> Family: Beta regression(24.906) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value     Pr(>|z|)    
#> (Intercept) -3.15491009  0.01203117 -262.22794   < 2.22e-16 ***
#> year2009     0.16017953  0.01535889   10.42911   < 2.22e-16 ***
#> year2011     0.22423453  0.01521530   14.73743   < 2.22e-16 ***
#> year2012     0.07695023  0.01670604    4.60613 0.0000041023 ***
#> year2013     0.28868238  0.01535012   18.80652   < 2.22e-16 ***
#> year2014     0.27339208  0.01584927   17.24951   < 2.22e-16 ***
#> year2015     0.26100119  0.01686041   15.48012   < 2.22e-16 ***
#> year2016     0.30722661  0.01745822   17.59782   < 2.22e-16 ***
#> year2017     0.40370221  0.01683132   23.98517   < 2.22e-16 ***
#> year2018     0.24364451  0.01701131   14.32250   < 2.22e-16 ***
#> year2019     0.21289143  0.01759856   12.09710   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.739492 8.980914  782.5095 < 2.22e-16 ***
#> s(gdp_per_capita) 8.945937 8.999029 7854.0728 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0487   Deviance explained = 16.1%
#> -REML = -1.1674e+05  Scale est. = 1         n = 57487
Code
maper_mpepr_gam_3 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 109: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_3 model.
Value Interpretation Rule
R2 0.0487055780 weak cohen1988
SE 0.0016758990 NA NA
Lower CI 0.0454208762 weak cohen1988
Upper CI 0.0519902797 weak cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_3 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 110: Summary statistics of the maper_mpepr_gam_3 model.
Value
df 28.685429756
logLik 116845.724333433
AIC -233631.488781631
BIC -233362.889058591
deviance 59536.185150791
df.residual 57458.314570244
nobs 57487.000000000
adj.r.squared 0.048705578
npar 29.000000000

Source: Created by the authors.

Code
maper_mpepr_gam_3 |>
  summarise_coefs() |>
  md_named_tibble()
Table 111: Value of the coefficients in the maper_mpepr_gam_3 model.
Value
[Mean] -0.3055395111
(Intercept) -3.1549100891
year2009 0.1601795330
year2011 0.2242345324
year2012 0.0769502297
year2013 0.2886823754
year2014 0.2733920755
year2015 0.2610011857
year2016 0.3072266135
year2017 0.4037022116
year2018 0.2436445091
year2019 0.2128914320
mean(s(spei_12m)) 0.0017632820
mean(s(gdp_per_capita)) -0.9081677744

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_3 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 143: Effects of each term in the maper_mpepr_gam_3 model.

Source: Created by the authors.

Code
maper_mpepr_gam_3 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.000000006064042157,0.0004676518947]
#> (score -116743.8866 & scale 1).
#> Hessian positive definite, eigenvalue range [3.173550905,25060.67586].
#> Model rank =  29 / 29 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>                     k'  edf k-index p-value  
#> s(spei_12m)       9.00 8.74    1.00    0.45  
#> s(gdp_per_capita) 9.00 8.95    0.98    0.09 .
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 144: Diagnostics for the maper_mpepr_gam_3 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_3,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 145: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_3 model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(year) (Continuous year)

Code
mbepr_gam_4 <- mgcv::gam(
  mbepr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_4 |> summary()
#> 
#> Family: Beta regression(17.632) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.819223463  0.003244516 -868.9196 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.517735 8.935257 302.3165 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00359   Deviance explained = 0.499%
#> -REML = -1.1796e+05  Scale est. = 1         n = 62762
Code
mbepr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 112: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mbepr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 113: Summary statistics of the mbepr_gam_4 model.
Value
df 9.5177348799
logLik 117986.4920079141
AIC -235951.1135022862
BIC -235852.1810852699
deviance 64482.0026382929
df.residual 62752.4822651201
nobs 62762.0000000000
adj.r.squared -0.0035886584
npar 10.0000000000

Source: Created by the authors.

Code
mbepr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 114: Value of the coefficients in the mbepr_gam_4 model.
Value
[Mean] -0.2591799301
(Intercept) -2.8192234633
mean(s(year)) 0.0252693513

Source: Created by the authors.

Code
plot <- mbepr_gam_4 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 146: Effects of each term in the mbepr_gam_4 model.

Source: Created by the authors.

Code
mbepr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.0000007308610019,0.03364194555]
#> (score -117956.7533 & scale 1).
#> Hessian positive definite, eigenvalue range [3.531791006,26569.1772].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.52    0.98    0.23
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 147: Diagnostics for the mbepr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 148: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_4 <- mgcv::gam(
  beipr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_4 |> summary()
#> 
#> Family: Beta regression(25.787) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.648641361  0.002748208 -963.7703 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.380103 8.894804 281.1438 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00755   Deviance explained = 0.486%
#> -REML = -1.1332e+05  Scale est. = 1         n = 62762
Code
beipr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 115: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
beipr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 116: Summary statistics of the beipr_gam_4 model.
Value
df 9.3801031575
logLik 113351.7302965717
AIC -226681.8554885659
BIC -226584.1236629445
deviance 63829.0813461868
df.residual 62752.6198968425
nobs 62762.0000000000
adj.r.squared -0.0075487984
npar 10.0000000000

Source: Created by the authors.

Code
beipr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 117: Value of the coefficients in the beipr_gam_4 model.
Value
[Mean] -0.2736261600
(Intercept) -2.6486413607
mean(s(year)) -0.0097355821

Source: Created by the authors.

Code
plot <- beipr_gam_4 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 149: Effects of each term in the beipr_gam_4 model.

Source: Created by the authors.

Code
beipr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [-0.0000000004378528651,0.00001056270043]
#> (score -113322.8181 & scale 1).
#> Hessian positive definite, eigenvalue range [3.395724488,29159.85227].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.38    1.01    0.92
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 150: Diagnostics for the beipr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 151: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_4 <- mgcv::gam(
  mbepr_beipr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_4 |> summary()
#> 
#> Family: Beta regression(16.293) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.96506495  0.00268522 -731.8079 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.44098 8.913794 235.0998 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0045   Deviance explained = 0.392%
#> -REML = -78452  Scale est. = 1         n = 62762
Code
mbepr_beipr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 118: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_4 model.
Value Interpretation Rule
R2 0.0045000402 very weak (negligible) cohen1988
SE 0.0005330977 NA NA
Lower CI 0.0034551879 very weak (negligible) cohen1988
Upper CI 0.0055448926 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 119: Summary statistics of the mbepr_beipr_gam_4 model.
Value
df 9.4409801854
logLik 78481.3360960384
AIC -156941.1983968910
BIC -156844.0605562020
deviance 61788.3616920760
df.residual 62752.5590198146
nobs 62762.0000000000
adj.r.squared 0.0045000402
npar 10.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 120: Value of the coefficients in the mbepr_beipr_gam_4 model.
Value
[Mean] -0.1919132142
(Intercept) -1.9650649515
mean(s(year)) 0.0051036454

Source: Created by the authors.

Code
plot <- mbepr_beipr_gam_4 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 152: Effects of each term in the mbepr_beipr_gam_4 model.

Source: Created by the authors.

Code
mbepr_beipr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.0001485521986,0.01425683628]
#> (score -78451.89082 & scale 1).
#> Hessian positive definite, eigenvalue range [3.542988508,30825.81986].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.44    0.98    0.17
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 153: Diagnostics for the mbepr_beipr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 154: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_4 <- mgcv::gam(
  maper ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_4 |> summary()
#> 
#> Family: Beta regression(24.478) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.670795216  0.003547555 -1034.739 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.587611 8.952185 318.7632 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00151   Deviance explained = 0.488%
#> -REML = -1.7521e+05  Scale est. = 1         n = 62762
Code
maper_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 121: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 122: Summary statistics of the maper_gam_4 model.
Value
df 9.5876109295
logLik 175244.4552867728
AIC -350467.0062043938
BIC -350367.9206397486
deviance 67164.5053157659
df.residual 62752.4123890705
nobs 62762.0000000000
adj.r.squared -0.0015113762
npar 10.0000000000

Source: Created by the authors.

Code
maper_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 123: Value of the coefficients in the maper_gam_4 model.
Value
[Mean] -0.3262673232
(Intercept) -3.6707952155
mean(s(year)) 0.0453468870

Source: Created by the authors.

Code
plot <- maper_gam_4 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 155: Effects of each term in the maper_gam_4 model.

Source: Created by the authors.

Code
maper_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [-0.000001789168296,0.1457289897]
#> (score -175214.1738 & scale 1).
#> Hessian positive definite, eigenvalue range [3.266969182,21653.71035].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.59       1    0.43
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 156: Diagnostics for the maper_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 157: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_4 <- mgcv::gam(
  mpepr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_4 |> summary()
#> 
#> Family: Beta regression(30.596) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.530426653  0.003291301 -1072.654 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.125824 8.797382 452.6992 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0126   Deviance explained = 0.688%
#> -REML = -1.6103e+05  Scale est. = 1         n = 62762
Code
mpepr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 124: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mpepr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 125: Summary statistics of the mpepr_gam_4 model.
Value
df 9.125823871
logLik 161057.642508866
AIC -322093.690254409
BIC -321996.005207994
deviance 67280.102592947
df.residual 62752.874176129
nobs 62762.000000000
adj.r.squared -0.012590109
npar 10.000000000

Source: Created by the authors.

Code
mpepr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 126: Value of the coefficients in the mpepr_gam_4 model.
Value
[Mean] -0.3632127806
(Intercept) -3.5304266535
mean(s(year)) -0.0113001281

Source: Created by the authors.

Code
plot <- mpepr_gam_4 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 158: Effects of each term in the mpepr_gam_4 model.

Source: Created by the authors.

Code
mpepr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.0000409648117,0.009724409113]
#> (score -161030.7811 & scale 1).
#> Hessian positive definite, eigenvalue range [3.051833023,24661.20026].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.13       1    0.56
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 159: Diagnostics for the mpepr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 160: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_4 <- mgcv::gam(
  maper_mpepr ~ s(year),
  data = dplyr::mutate(data, year = as.integer(as.character(year))),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_4 |> summary()
#> 
#> Family: Beta regression(20.399) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.877019036  0.003155272 -911.8133 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.577875 8.950003 332.6079 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.000687   Deviance explained = 0.525%
#> -REML = -1.2164e+05  Scale est. = 1         n = 62762
Code
maper_mpepr_gam_4 |>
  summarise_r2(
    dplyr::mutate(data, year = as.integer(as.character(year))) |>
      nrow()
  ) |>
  md_named_tibble()
Table 127: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_4 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_4 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 128: Summary statistics of the maper_mpepr_gam_4 model.
Value
df 9.5778747519
logLik 121672.7902501706
AIC -243323.6804947727
BIC -243224.6146690252
deviance 64882.8996527854
df.residual 62752.4221252481
nobs 62762.0000000000
adj.r.squared -0.0006872297
npar 10.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_4 |>
  summarise_coefs() |>
  md_named_tibble()
Table 129: Value of the coefficients in the maper_mpepr_gam_4 model.
Value
[Mean] -0.2723942217
(Intercept) -2.8770190360
mean(s(year)) 0.0170085354

Source: Created by the authors.

Code
plot <- maper_mpepr_gam_4 |>  mgcViz::getViz() |> plot()

for(i in plot$plots) print(i)
Figure 161: Effects of each term in the maper_mpepr_gam_4 model.

Source: Created by the authors.

Code
maper_mpepr_gam_4 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 6 iterations.
#> Gradient range [0.001452357338,0.001462095772]
#> (score -121642.3846 & scale 1).
#> Hessian positive definite, eigenvalue range [3.300163003,26958.96005].
#> Model rank =  10 / 10 
#> 
#> Basis dimension (k) checking results. Low p-value (k-index<1) may
#> indicate that k is too low, especially if edf is close to k'.
#> 
#>           k'  edf k-index p-value
#> s(year) 9.00 8.58       1     0.6
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 162: Diagnostics for the maper_mpepr_gam_4 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_4,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 163: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_4 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Ordered)

In this model, the year variable is treated as a ordered categorical variable.

.L, .Q, and .C are, respectively, the coefficients for the ordered factor coded with linear, quadratic, and cubic contrasts.

Code
mbepr_gam_5 <- mgcv::gam(
  mbepr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_5 |> summary()
#> 
#> Family: Beta regression(17.638) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.819724761  0.003245311 -868.86131           < 2.22e-16 ***
#> year.L       0.039878128  0.011320870    3.52253           0.00042745 ***
#> year.Q      -0.106048138  0.011379691   -9.31907           < 2.22e-16 ***
#> year.C       0.004592172  0.011329411    0.40533           0.68523353    
#> year^4      -0.084506343  0.011264853   -7.50177 0.000000000000062962 ***
#> year^5       0.115842989  0.011244823   10.30190           < 2.22e-16 ***
#> year^6      -0.049357350  0.011184889   -4.41286 0.000010201391317061 ***
#> year^7      -0.009601510  0.011183504   -0.85854           0.39059315    
#> year^8       0.052923709  0.011165129    4.74009 0.000002136239494897 ***
#> year^9      -0.019333845  0.011154098   -1.73334           0.08303524 .  
#> year^10     -0.058854569  0.011214557   -5.24805 0.000000153716732986 ***
#> year^11     -0.017281456  0.011218670   -1.54042           0.12345819    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00327   Deviance explained = 0.525%
#> -REML = -1.1795e+05  Scale est. = 1         n = 62762
Code
mbepr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 130: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mbepr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 131: Summary statistics of the mbepr_gam_5 model.
Value
df 12.0000000000
logLik 117994.6877479883
AIC -235963.3754959765
BIC -235845.7631300175
deviance 64485.5210188838
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0032733397
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 132: Value of the coefficients in the mbepr_gam_5 model.
Value
[Mean] -0.2459559144
(Intercept) -2.8197247609
year.L 0.0398781283
year.Q -0.1060481384
year.C 0.0045921722
year^4 -0.0845063430
year^5 0.1158429895
year^6 -0.0493573500
year^7 -0.0096015103
year^8 0.0529237091
year^9 -0.0193338448
year^10 -0.0588545690
year^11 -0.0172814558

Source: Created by the authors.

Code
mbepr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.000001198946155,0.000001198946155]
#> (score -117950.6115 & scale 1).
#> Hessian positive definite, eigenvalue range [26571.0456,26571.0456].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 164: Diagnostics for the mbepr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 165: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_5 <- mgcv::gam(
  beipr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_5 |> summary()
#> 
#> Family: Beta regression(25.798) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.649018998  0.002748798 -963.70086          < 2.22e-16 ***
#> year.L       0.089565087  0.009525353    9.40281          < 2.22e-16 ***
#> year.Q       0.008970089  0.009602439    0.93415           0.3502281    
#> year.C      -0.026710792  0.009568146   -2.79164           0.0052442 ** 
#> year^4      -0.070578182  0.009512419   -7.41958 0.00000000000011749 ***
#> year^5       0.082998344  0.009501906    8.73492          < 2.22e-16 ***
#> year^6      -0.043857480  0.009483389   -4.62466 0.00000375207630563 ***
#> year^7      -0.043134260  0.009459485   -4.55990 0.00000511791590338 ***
#> year^8       0.048173854  0.009463350    5.09057 0.00000035698739739 ***
#> year^9       0.004749118  0.009500885    0.49986           0.6171732    
#> year^10     -0.003885200  0.009548341   -0.40690           0.6840830    
#> year^11      0.047418864  0.009576401    4.95164 0.00000073591609239 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00784   Deviance explained = 0.52%
#> -REML = -1.1332e+05  Scale est. = 1         n = 62762
Code
beipr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 133: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
beipr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 134: Summary statistics of the beipr_gam_5 model.
Value
df 12.0000000000
logLik 113362.5968849334
AIC -226699.1937698668
BIC -226581.5814039078
deviance 63831.4178238831
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0078397415
npar 12.0000000000

Source: Created by the authors.

Code
beipr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 135: Value of the coefficients in the beipr_gam_5 model.
Value
[Mean] -0.2129424629
(Intercept) -2.6490189976
year.L 0.0895650875
year.Q 0.0089700894
year.C -0.0267107916
year^4 -0.0705781816
year^5 0.0829983439
year^6 -0.0438574801
year^7 -0.0431342600
year^8 0.0481738541
year^9 0.0047491179
year^10 -0.0038852003
year^11 0.0474188640

Source: Created by the authors.

Code
beipr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.00000875780144,0.00000875780144]
#> (score -113316.5276 & scale 1).
#> Hessian positive definite, eigenvalue range [29161.5517,29161.5517].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 166: Diagnostics for the beipr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 167: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_5 <- mgcv::gam(
  mbepr_beipr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_5 |> summary()
#> 
#> Family: Beta regression(16.296) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -1.965102548  0.002685499 -731.74585       < 2.22e-16 ***
#> year.L      -0.047271406  0.009320041   -5.07202 0.00000039362084 ***
#> year.Q      -0.013637154  0.009377919   -1.45418       0.14589726    
#> year.C      -0.007039030  0.009352037   -0.75267       0.45164616    
#> year^4      -0.058196732  0.009300741   -6.25721 0.00000000039191 ***
#> year^5       0.093573558  0.009290835   10.07160       < 2.22e-16 ***
#> year^6      -0.052789757  0.009257180   -5.70257 0.00000001180112 ***
#> year^7      -0.020548391  0.009258158   -2.21949       0.02645340 *  
#> year^8       0.046041585  0.009257142    4.97363 0.00000065711276 ***
#> year^9       0.005464968  0.009268416    0.58963       0.55543643    
#> year^10     -0.035902530  0.009320676   -3.85192       0.00011719 ***
#> year^11      0.012717049  0.009327199    1.36344       0.17274482    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00446   Deviance explained = 0.406%
#> -REML = -78439  Scale est. = 1         n = 62762
Code
mbepr_beipr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 136: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_5 model.
Value Interpretation Rule
R2 0.0044644574 very weak (negligible) cohen1988
SE 0.0005310049 NA NA
Lower CI 0.0034237070 very weak (negligible) cohen1988
Upper CI 0.0055052078 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 137: Summary statistics of the mbepr_beipr_gam_5 model.
Value
df 12.0000000000
logLik 78485.5946634256
AIC -156945.1893268511
BIC -156827.5769608921
deviance 61789.7893367158
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared 0.0044644574
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 138: Value of the coefficients in the mbepr_beipr_gam_5 model.
Value
[Mean] -0.1702241990
(Intercept) -1.9651025476
year.L -0.0472714062
year.Q -0.0136371535
year.C -0.0070390298
year^4 -0.0581967323
year^5 0.0935735582
year^6 -0.0527897574
year^7 -0.0205483915
year^8 0.0460415848
year^9 0.0054649678
year^10 -0.0359025295
year^11 0.0127170490

Source: Created by the authors.

Code
mbepr_beipr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.01219855648,0.01219855648]
#> (score -78439.24791 & scale 1).
#> Hessian positive definite, eigenvalue range [30826.9659,30826.9659].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 168: Diagnostics for the mbepr_beipr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 169: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_5 <- mgcv::gam(
  maper ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_5 |> summary()
#> 
#> Family: Beta regression(24.482) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error     z value             Pr(>|z|)    
#> (Intercept) -3.671007620  0.003548104 -1034.63917           < 2.22e-16 ***
#> year.L       0.027842144  0.012368692     2.25102            0.0243844 *  
#> year.Q      -0.134341841  0.012419112   -10.81735           < 2.22e-16 ***
#> year.C      -0.082483360  0.012340935    -6.68372 0.000000000023295072 ***
#> year^4      -0.080548801  0.012313726    -6.54138 0.000000000060952495 ***
#> year^5       0.079273119  0.012318076     6.43551 0.000000000123058147 ***
#> year^6       0.024429920  0.012282057     1.98907            0.0466930 *  
#> year^7       0.035558528  0.012236630     2.90591            0.0036619 ** 
#> year^8       0.092660310  0.012200680     7.59468 0.000000000000030854 ***
#> year^9      -0.006557267  0.012197699    -0.53758            0.5908655    
#> year^10     -0.025618488  0.012238256    -2.09331            0.0363213 *  
#> year^11      0.011818501  0.012283076     0.96218            0.3359604    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00149   Deviance explained = 0.495%
#> -REML = -1.752e+05  Scale est. = 1         n = 62762
Code
maper_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 139: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 140: Summary statistics of the maper_gam_5 model.
Value
df 12.0000000000
logLik 175246.8729737456
AIC -350467.7459474911
BIC -350350.1335815321
deviance 67168.5892269482
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0014912039
npar 12.0000000000

Source: Created by the authors.

Code
maper_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 141: Value of the coefficients in the maper_gam_5 model.
Value
[Mean] -0.3107479047
(Intercept) -3.6710076200
year.L 0.0278421438
year.Q -0.1343418412
year.C -0.0824833604
year^4 -0.0805488010
year^5 0.0792731188
year^6 0.0244299196
year^7 0.0355585277
year^8 0.0926603095
year^9 -0.0065572665
year^10 -0.0256184884
year^11 0.0118185012

Source: Created by the authors.

Code
maper_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.0000105819692,0.0000105819692]
#> (score -175203.8687 & scale 1).
#> Hessian positive definite, eigenvalue range [21654.98712,21654.98712].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 170: Diagnostics for the maper_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 171: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_5 <- mgcv::gam(
  mpepr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_5 |> summary()
#> 
#> Family: Beta regression(30.606) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error     z value       Pr(>|z|)    
#> (Intercept) -3.531198908  0.003292509 -1072.49476     < 2.22e-16 ***
#> year.L       0.153669624  0.011448326    13.42289     < 2.22e-16 ***
#> year.Q      -0.049777612  0.011560586    -4.30580 0.000016638072 ***
#> year.C      -0.061042356  0.011439084    -5.33630 0.000000094864 ***
#> year^4      -0.152562348  0.011424506   -13.35396     < 2.22e-16 ***
#> year^5       0.023769084  0.011408711     2.08342      0.0372134 *  
#> year^6       0.053608763  0.011388065     4.70745 0.000002508330 ***
#> year^7       0.032808996  0.011321353     2.89797      0.0037558 ** 
#> year^8       0.051603530  0.011292849     4.56958 0.000004887127 ***
#> year^9      -0.007970576  0.011315547    -0.70439      0.4811890    
#> year^10      0.012958743  0.011360197     1.14071      0.2539887    
#> year^11      0.021167522  0.011499317     1.84076      0.0656562 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0125   Deviance explained = 0.712%
#> -REML = -1.6102e+05  Scale est. = 1         n = 62762
Code
mpepr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 142: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mpepr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 143: Summary statistics of the mpepr_gam_5 model.
Value
df 12.0000000000
logLik 161065.5110249491
AIC -322105.0220498982
BIC -321987.4096839392
deviance 67283.6524796425
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0125163328
npar 12.0000000000

Source: Created by the authors.

Code
mpepr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 144: Value of the coefficients in the mpepr_gam_5 model.
Value
[Mean] -0.2877471282
(Intercept) -3.5311989080
year.L 0.1536696243
year.Q -0.0497776119
year.C -0.0610423562
year^4 -0.1525623482
year^5 0.0237690842
year^6 0.0536087631
year^7 0.0328089956
year^8 0.0516035296
year^9 -0.0079705756
year^10 0.0129587426
year^11 0.0211675220

Source: Created by the authors.

Code
mpepr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 3 iterations.
#> Gradient range [0.06495643988,0.06495643988]
#> (score -161021.6064 & scale 1).
#> Hessian positive definite, eigenvalue range [24663.52749,24663.52749].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 172: Diagnostics for the mpepr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 173: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_5 <- mgcv::gam(
  maper_mpepr ~ year,
  data = data,
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_5 |> summary()
#> 
#> Family: Beta regression(20.406) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -2.877375499  0.003155866 -911.75453         < 2.22e-16 ***
#> year.L       0.013586860  0.010994060    1.23584            0.21652    
#> year.Q      -0.078213051  0.011085949   -7.05515 0.0000000000017241 ***
#> year.C      -0.070927872  0.010973416   -6.46361 0.0000000001022349 ***
#> year^4      -0.128530430  0.010948898  -11.73912         < 2.22e-16 ***
#> year^5       0.046957484  0.010954014    4.28678 0.0000181278821559 ***
#> year^6       0.047973032  0.010925669    4.39086 0.0000112905702940 ***
#> year^7       0.056102588  0.010852567    5.16952 0.0000002346931480 ***
#> year^8       0.076581290  0.010814002    7.08168 0.0000000000014242 ***
#> year^9      -0.008376653  0.010832943   -0.77326            0.43937    
#> year^10      0.006769788  0.010884854    0.62195            0.53398    
#> year^11      0.004430077  0.010985307    0.40327            0.68675    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.000592   Deviance explained = 0.552%
#> -REML = -1.2164e+05  Scale est. = 1         n = 62762
Code
maper_mpepr_gam_5 |>
  summarise_r2(
    data |>
      nrow()
  ) |>
  md_named_tibble()
Table 145: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_5 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_5 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 146: Summary statistics of the maper_mpepr_gam_5 model.
Value
df 12.0000000000
logLik 121681.2905335238
AIC -243336.5810670477
BIC -243218.9687010887
deviance 64886.5484799453
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0005918146
npar 12.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_5 |>
  summarise_coefs() |>
  md_named_tibble()
Table 147: Value of the coefficients in the maper_mpepr_gam_5 model.
Value
[Mean] -0.2425851988
(Intercept) -2.8773754994
year.L 0.0135868602
year.Q -0.0782130509
year.C -0.0709278716
year^4 -0.1285304305
year^5 0.0469574842
year^6 0.0479730318
year^7 0.0561025880
year^8 0.0765812902
year^9 -0.0083766531
year^10 0.0067697882
year^11 0.0044300767

Source: Created by the authors.

Code
maper_mpepr_gam_5 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.1322078474,0.1322078474]
#> (score -121636.8789 & scale 1).
#> Hessian positive definite, eigenvalue range [26961.29141,26961.29141].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 174: Diagnostics for the maper_mpepr_gam_5 model.

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_5,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 175: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_5 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Unordered)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_6 <- mgcv::gam(
  mbepr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_gam_6 |> summary()
#> 
#> Family: Beta regression(17.638) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.95978829  0.01184997 -249.77179           < 2.22e-16 ***
#> year2009     0.18581894  0.01623717   11.44404           < 2.22e-16 ***
#> year2010     0.19650008  0.01620364   12.12691           < 2.22e-16 ***
#> year2011     0.11636277  0.01634690    7.11834 0.000000000001092351 ***
#> year2012     0.07206778  0.01640557    4.39288 0.000011185640406729 ***
#> year2013     0.16526735  0.01635417   10.10552           < 2.22e-16 ***
#> year2014     0.21516820  0.01625094   13.24035           < 2.22e-16 ***
#> year2015     0.14714754  0.01632144    9.01560           < 2.22e-16 ***
#> year2016     0.20560208  0.01618365   12.70431           < 2.22e-16 ***
#> year2017     0.15465732  0.01628361    9.49773           < 2.22e-16 ***
#> year2018     0.12309673  0.01633175    7.53727 0.000000000000047993 ***
#> year2019     0.09907351  0.01632576    6.06854 0.000000001290783738 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00327   Deviance explained = 0.525%
#> -REML = -1.1795e+05  Scale est. = 1         n = 62762
Code
mbepr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 148: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mbepr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 149: Summary statistics of the mbepr_gam_6 model.
Value
df 12.0000000000
logLik 117994.6877479886
AIC -235963.3754959772
BIC -235845.7631300182
deviance 64485.5210188823
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0032733397
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 150: Value of the coefficients in the mbepr_gam_6 model.
Value
[Mean] -0.1065854982
(Intercept) -2.9597882866
year2009 0.1858189412
year2010 0.1965000821
year2011 0.1163627678
year2012 0.0720677836
year2013 0.1652673488
year2014 0.2151681982
year2015 0.1471475383
year2016 0.2056020840
year2017 0.1546573211
year2018 0.1230967302
year2019 0.0990735131

Source: Created by the authors.

Code
mbepr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.00000119875011,0.00000119875011]
#> (score -117951.854 & scale 1).
#> Hessian positive definite, eigenvalue range [26571.0456,26571.0456].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 176: Diagnostics for the mbepr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 177: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_6 <- mgcv::gam(
  beipr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
beipr_gam_6 |> summary()
#> 
#> Family: Beta regression(25.798) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.722549043  0.009951744 -273.57506 < 2.22e-16 ***
#> year2009     0.093774149  0.013717615    6.83604 8.1413e-12 ***
#> year2010     0.106949012  0.013679330    7.81829 5.3544e-15 ***
#> year2011     0.025696817  0.013841904    1.85645   0.063389 .  
#> year2012    -0.037917921  0.013952806   -2.71758   0.006576 ** 
#> year2013     0.070849601  0.013832071    5.12213 3.0211e-07 ***
#> year2014     0.080692900  0.013799146    5.84767 4.9850e-09 ***
#> year2015     0.124328975  0.013673487    9.09270 < 2.22e-16 ***
#> year2016     0.085008464  0.013717882    6.19691 5.7583e-10 ***
#> year2017     0.121341258  0.013658424    8.88399 < 2.22e-16 ***
#> year2018     0.117922729  0.013660107    8.63264 < 2.22e-16 ***
#> year2019     0.093714562  0.013667701    6.85664 7.0497e-12 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00784   Deviance explained = 0.52%
#> -REML = -1.1332e+05  Scale est. = 1         n = 62762
Code
beipr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 151: Confidence interval for the adjusted \(\text{R}^{2}\) of the beipr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
beipr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 152: Summary statistics of the beipr_gam_6 model.
Value
df 12.0000000000
logLik 113362.5968849338
AIC -226699.1937698676
BIC -226581.5814039086
deviance 63831.4178238829
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0078397415
npar 12.0000000000

Source: Created by the authors.

Code
beipr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 153: Value of the coefficients in the beipr_gam_6 model.
Value
[Mean] -0.1533490415
(Intercept) -2.7225490430
year2009 0.0937741492
year2010 0.1069490117
year2011 0.0256968171
year2012 -0.0379179214
year2013 0.0708496009
year2014 0.0806929002
year2015 0.1243289749
year2016 0.0850084637
year2017 0.1213412578
year2018 0.1179227286
year2019 0.0937145617

Source: Created by the authors.

Code
beipr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.000008758086041,0.000008758086041]
#> (score -113317.7701 & scale 1).
#> Hessian positive definite, eigenvalue range [29161.5517,29161.5517].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 178: Diagnostics for the beipr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = beipr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 179: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_6 <- mgcv::gam(
  mbepr_beipr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mbepr_beipr_gam_6 |> summary()
#> 
#> Family: Beta regression(16.296) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -1.998038053  0.009599818 -208.13291         < 2.22e-16 ***
#> year2009     0.115589875  0.013212260    8.74868         < 2.22e-16 ***
#> year2010     0.093268110  0.013236994    7.04602 0.0000000000018411 ***
#> year2011     0.020589852  0.013365365    1.54054         0.12342928    
#> year2012    -0.046723027  0.013469180   -3.46888         0.00052262 ***
#> year2013     0.042609937  0.013403990    3.17890         0.00147835 ** 
#> year2014     0.068768866  0.013345526    5.15295 0.0000002564166243 ***
#> year2015     0.035954417  0.013361657    2.69087         0.00712670 ** 
#> year2016     0.032964579  0.013335521    2.47194         0.01343829 *  
#> year2017     0.027139886  0.013355914    2.03205         0.04214858 *  
#> year2018     0.009562646  0.013381355    0.71462         0.47484103    
#> year2019    -0.004499079  0.013366541   -0.33659         0.73642405    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00446   Deviance explained = 0.406%
#> -REML = -78440  Scale est. = 1         n = 62762
Code
mbepr_beipr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 154: Confidence interval for the adjusted \(\text{R}^{2}\) of the mbepr_beipr_gam_6 model.
Value Interpretation Rule
R2 0.0044644574 very weak (negligible) cohen1988
SE 0.0005310049 NA NA
Lower CI 0.0034237070 very weak (negligible) cohen1988
Upper CI 0.0055052078 very weak (negligible) cohen1988

Source: Created by the authors.

Code
mbepr_beipr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 155: Summary statistics of the mbepr_beipr_gam_6 model.
Value
df 12.0000000000
logLik 78485.5946634255
AIC -156945.1893268510
BIC -156827.5769608920
deviance 61789.7893367161
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared 0.0044644574
npar 12.0000000000

Source: Created by the authors.

Code
mbepr_beipr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 156: Value of the coefficients in the mbepr_beipr_gam_6 model.
Value
[Mean] -0.1335676658
(Intercept) -1.9980380529
year2009 0.1155898751
year2010 0.0932681104
year2011 0.0205898519
year2012 -0.0467230271
year2013 0.0426099372
year2014 0.0687688662
year2015 0.0359544170
year2016 0.0329645792
year2017 0.0271398862
year2018 0.0095626455
year2019 -0.0044990787

Source: Created by the authors.

Code
mbepr_beipr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 5 iterations.
#> Gradient range [0.01219855661,0.01219855661]
#> (score -78440.49037 & scale 1).
#> Hessian positive definite, eigenvalue range [30826.9659,30826.9659].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 180: Diagnostics for the mbepr_beipr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mbepr_beipr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
Figure 181: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_6 <- mgcv::gam(
  maper ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_gam_6 |> summary()
#> 
#> Family: Beta regression(24.482) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.758990530  0.012747837 -294.87282           < 2.22e-16 ***
#> year2009     0.083861654  0.017695514    4.73915 0.000002146191308382 ***
#> year2010     0.126540065  0.017619775    7.18171 0.000000000000688463 ***
#> year2011     0.058108129  0.017719687    3.27930            0.0010407 ** 
#> year2012     0.030105437  0.017738763    1.69716            0.0896673 .  
#> year2013     0.124723975  0.017728977    7.03504 0.000000000001992108 ***
#> year2014     0.134593862  0.017697517    7.60524 0.000000000000028438 ***
#> year2015     0.119405131  0.017665879    6.75908 0.000000000013886856 ***
#> year2016     0.174963896  0.017546352    9.97153           < 2.22e-16 ***
#> year2017     0.190981494  0.017536505   10.89051           < 2.22e-16 ***
#> year2018     0.015059851  0.017772131    0.84739            0.3967802    
#> year2019    -0.002548577  0.017742683   -0.14364            0.8857840    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00149   Deviance explained = 0.495%
#> -REML = -1.7521e+05  Scale est. = 1         n = 62762
Code
maper_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 157: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 158: Summary statistics of the maper_gam_6 model.
Value
df 12.0000000000
logLik 175246.8729737457
AIC -350467.7459474914
BIC -350350.1335815324
deviance 67168.5892269479
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0014912039
npar 12.0000000000

Source: Created by the authors.

Code
maper_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 159: Value of the coefficients in the maper_gam_6 model.
Value
[Mean] -0.2252663011
(Intercept) -3.7589905297
year2009 0.0838616542
year2010 0.1265400648
year2011 0.0581081288
year2012 0.0301054374
year2013 0.1247239748
year2014 0.1345938625
year2015 0.1194051310
year2016 0.1749638956
year2017 0.1909814936
year2018 0.0150598506
year2019 -0.0025485765

Source: Created by the authors.

Code
maper_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.00001058207839,0.00001058207839]
#> (score -175205.1112 & scale 1).
#> Hessian positive definite, eigenvalue range [21654.98712,21654.98712].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 182: Diagnostics for the maper_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 183: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_6 <- mgcv::gam(
  mpepr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
mpepr_gam_6 |> summary()
#> 
#> Family: Beta regression(30.606) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.65301970  0.01197372 -305.08648       < 2.22e-16 ***
#> year2009     0.08052386  0.01658941    4.85393 0.00000121037627 ***
#> year2010     0.14196333  0.01646757    8.62078       < 2.22e-16 ***
#> year2011     0.09031173  0.01656285    5.45267 0.00000004961916 ***
#> year2012     0.06937855  0.01658203    4.18396 0.00002864737535 ***
#> year2013     0.09082284  0.01665623    5.45278 0.00000004958750 ***
#> year2014     0.07948343  0.01665956    4.77104 0.00000183275897 ***
#> year2015     0.14890933  0.01648873    9.03098       < 2.22e-16 ***
#> year2016     0.21623256  0.01633233   13.23954       < 2.22e-16 ***
#> year2017     0.28393957  0.01622278   17.50252       < 2.22e-16 ***
#> year2018     0.15693014  0.01644361    9.54353       < 2.22e-16 ***
#> year2019     0.10335415  0.01648944    6.26790 0.00000000036595 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0125   Deviance explained = 0.712%
#> -REML = -1.6102e+05  Scale est. = 1         n = 62762
Code
mpepr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 160: Confidence interval for the adjusted \(\text{R}^{2}\) of the mpepr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
mpepr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 161: Summary statistics of the mpepr_gam_6 model.
Value
df 12.0000000000
logLik 161065.5110249493
AIC -322105.0220498986
BIC -321987.4096839396
deviance 67283.6524796410
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0125163328
npar 12.0000000000

Source: Created by the authors.

Code
mpepr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 162: Value of the coefficients in the mpepr_gam_6 model.
Value
[Mean] -0.1825975171
(Intercept) -3.6530196992
year2009 0.0805238602
year2010 0.1419633321
year2011 0.0903117322
year2012 0.0693785534
year2013 0.0908228362
year2014 0.0794834342
year2015 0.1489093298
year2016 0.2162325595
year2017 0.2839395689
year2018 0.1569301378
year2019 0.1033541501

Source: Created by the authors.

Code
mpepr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 3 iterations.
#> Gradient range [0.06495643969,0.06495643969]
#> (score -161022.8488 & scale 1).
#> Hessian positive definite, eigenvalue range [24663.52749,24663.52749].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 184: Diagnostics for the mpepr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = mpepr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 185: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_6 <- mgcv::gam(
  maper_mpepr ~ year,
  data = dplyr::mutate(data, year = factor(year, ordered = FALSE)),
  family = mgcv::betar(link = "logit"),
  method = "REML"
)
maper_mpepr_gam_6 |> summary()
#> 
#> Family: Beta regression(20.406) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.94365857  0.01135972 -259.13115           < 2.22e-16 ***
#> year2009     0.07932584  0.01572402    5.04488 0.000000453801089922 ***
#> year2010     0.12042580  0.01563447    7.70258 0.000000000000013334 ***
#> year2011     0.04361417  0.01577935    2.76400           0.00570971 ** 
#> year2012     0.03529717  0.01577849    2.23704           0.02528347 *  
#> year2013     0.05934068  0.01584106    3.74601           0.00017967 ***
#> year2014     0.05298592  0.01583706    3.34569           0.00082078 ***
#> year2015     0.07218084  0.01575428    4.58166 0.000004612884552903 ***
#> year2016     0.14183664  0.01559137    9.09713           < 2.22e-16 ***
#> year2017     0.19522378  0.01550575   12.59041           < 2.22e-16 ***
#> year2018     0.01346871  0.01583000    0.85083           0.39486145    
#> year2019    -0.01830271  0.01584025   -1.15546           0.24790357    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.000592   Deviance explained = 0.552%
#> -REML = -1.2164e+05  Scale est. = 1         n = 62762
Code
maper_mpepr_gam_6 |>
  summarise_r2(
    dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
      nrow()
  ) |>
  md_named_tibble()
Table 163: Confidence interval for the adjusted \(\text{R}^{2}\) of the maper_mpepr_gam_6 model.
Value Interpretation Rule
R2 0 no effect cohen1988
SE 0 NA NA
Lower CI 0 no effect cohen1988
Upper CI 0 no effect cohen1988

Source: Created by the authors.

Code
maper_mpepr_gam_6 |>
  broom::glance() |>
  tidyr::pivot_longer(dplyr::everything()) |>
  md_named_tibble()
Table 164: Summary statistics of the maper_mpepr_gam_6 model.
Value
df 12.0000000000
logLik 121681.2905335242
AIC -243336.5810670483
BIC -243218.9687010893
deviance 64886.5484799459
df.residual 62750.0000000000
nobs 62762.0000000000
adj.r.squared -0.0005918146
npar 12.0000000000

Source: Created by the authors.

Code
maper_mpepr_gam_6 |>
  summarise_coefs() |>
  md_named_tibble()
Table 165: Value of the coefficients in the maper_mpepr_gam_6 model.
Value
[Mean] -0.1790218116
(Intercept) -2.9436585686
year2009 0.0793258356
year2010 0.1204258006
year2011 0.0436141695
year2012 0.0352971701
year2013 0.0593406827
year2014 0.0529859157
year2015 0.0721808446
year2016 0.1418366420
year2017 0.1952237764
year2018 0.0134687055
year2019 -0.0183027132

Source: Created by the authors.

Code
maper_mpepr_gam_6 |> mgcViz::getViz() |> mgcViz::check.gamViz()
#> 
#> Method: REML   Optimizer: outer newton
#> full convergence after 4 iterations.
#> Gradient range [0.132207848,0.132207848]
#> (score -121638.1214 & scale 1).
#> Hessian positive definite, eigenvalue range [26961.29141,26961.29141].
#> Model rank =  12 / 12
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Figure 186: Diagnostics for the maper_mpepr_gam_6 model.

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam(
    model = maper_mpepr_gam_6,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 187: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_6 model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Model Results by MISFS-R Clusters

By s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re") (Continuous year)

Code
mbepr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.474) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.77050143  0.02238914 -123.7431 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       3.585424039145 4.506802 50.28722 < 2.22e-16 ***
#> s(gdp_per_capita) 6.325078765838 7.463139 30.61648 0.00012567 ***
#> s(year)           0.000007142564 1.000000  0.00098 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.000487   Deviance explained = 1.22%
#> -REML = -13357  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.091050995e+1
#> 2 logLik         1.338233071e+4
#> 3 AIC           -2.673672152e+4
#> 4 BIC           -2.664044549e+4
#> 5 deviance       7.444556183e+3
#> 6 df.residual    7.260089490e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.873290164e-4
#> 9 npar           2          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.824) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.079223123  0.007943255 -387.6526 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.463785332006 8.434566 203.62496 < 2.22e-16 ***
#> s(gdp_per_capita) 8.388424661548 8.881697 262.46921 < 2.22e-16 ***
#> s(year)           0.000002408109 1.000000   0.00049 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.000775   Deviance explained = 1.47%
#> -REML = -62596  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.685221240e+1
#> 2 logLik         6.264328753e+4
#> 3 AIC           -1.252479425e+5
#> 4 BIC           -1.250880695e+5
#> 5 deviance       3.064180952e+4
#> 6 df.residual    2.902814779e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -7.750953394e-4
#> 9 npar           2          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(40.074) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.61784753  0.01350421 -193.8542 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq     p-value    
#> s(spei_12m)       8.185619968319 8.824611  83.42890  < 2.22e-16 ***
#> s(gdp_per_capita) 8.779018990738 8.984698 289.37065  < 2.22e-16 ***
#> s(year)           0.000008673734 1.000000   0.00014 0.000070913 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0408   Deviance explained =    3%
#> -REML = -35893  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.079981636e-2 weak           cohen1988
#> 2 SE       2.717354051e-3 <NA>           <NA>     
#> 3 Lower CI 3.547390028e-2 weak           cohen1988
#> 4 Upper CI 4.612573243e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.796464763e+1
#> 2 logLik         3.594746970e+4
#> 3 AIC           -7.185532075e+4
#> 4 BIC           -7.170016045e+4
#> 5 deviance       1.813362262e+4
#> 6 df.residual    1.861503535e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.079981636e-2
#> 9 npar           2          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(37.043) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error  z value   Pr(>|z|)    
#> (Intercept) -2.28660135  0.02392335 -95.5803 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq  p-value    
#> s(spei_12m)       3.869415025716 4.856561  13.08541 0.021844 *  
#> s(gdp_per_capita) 7.508511900702 8.408435 207.78266  < 2e-16 ***
#> s(year)           0.000007236705 1.000000   0.00000 0.511048    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.086   Deviance explained = 9.78%
#> -REML = -4347.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.08597159417 weak           cohen1988
#> 2 SE       0.01016400052 <NA>           <NA>     
#> 3 Lower CI 0.06605051921 weak           cohen1988
#> 4 Upper CI 0.1058926691  weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.237793416e+1
#> 2 logLik         4.377235198e+3
#> 3 AIC           -8.723982867e+3
#> 4 BIC           -8.634972518e+3
#> 5 deviance       2.454448364e+3
#> 6 df.residual    2.525622066e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  8.597159417e-2
#> 9 npar           2          e+1
Code
mbepr_gam_1_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 166: Value of the coefficients in the mbepr_gam_1_by_misfs model.
A B C D
[Mean] -0.1310537568 -0.1577685877 -0.3738963240 -0.5898886872
(Intercept) -2.7705014320 -3.0792231234 -2.6178475305 -2.2866013524
mean(s(spei_12m)) -0.0012567827 0.0142475960 0.0052501770 0.0062860207
mean(s(gdp_per_capita)) 0.0178596693 -0.0227085623 -0.5452589573 -1.0630829510
mean(s(year)) 0.0000003165 0.0000000669 0.0000000742 -0.0000000186

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 188: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(beipr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.478) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.65185711  0.02206313 -120.1941 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       6.693819283232 7.864433 88.80543 < 2.22e-16 ***
#> s(gdp_per_capita) 7.883052707882 8.661109 45.75864 < 2.22e-16 ***
#> s(year)           0.000009250345 1.000000  0.00205 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0106   Deviance explained =  1.8%
#> -REML = -13098  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.059458631e-2 very weak (negligible) cohen1988
#> 2 SE       2.285067766e-3 <NA>                   <NA>     
#> 3 Lower CI 6.115935782e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.507323683e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.557688124e+1
#> 2 logLik         1.313629340e+4
#> 3 AIC           -2.623575478e+4
#> 4 BIC           -2.610883805e+4
#> 5 deviance       7.376756920e+3
#> 6 df.residual    7.255423119e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.059458631e-2
#> 9 npar           2          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.911) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -2.854708408  0.007573918 -376.913 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.77860683719 8.626997 180.04109 < 2.22e-16 ***
#> s(gdp_per_capita) 8.54053036718 8.931484 253.93093 < 2.22e-16 ***
#> s(year)           0.00000328935 1.000000   0.00125 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00596   Deviance explained = 1.37%
#> -REML = -56307  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.731914049e+1
#> 2 logLik         5.635651747e+4
#> 3 AIC           -1.126739180e+5
#> 4 BIC           -1.125120401e+5
#> 5 deviance       3.031151833e+4
#> 6 df.residual    2.902768086e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -5.956767481e-3
#> 9 npar           2          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(75.056) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.511152305  0.008421084 -298.1982 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.428944876816 8.910947  55.18369 < 2.22e-16 ***
#> s(gdp_per_capita) 8.882571386492 8.995635 698.45008 < 2.22e-16 ***
#> s(year)           0.000006025711 1.000000   0.00069 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0716   Deviance explained = 4.86%
#> -REML = -39633  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       7.160714322e-2 weak           cohen1988
#> 2 SE       3.484318398e-3 <NA>           <NA>     
#> 3 Lower CI 6.477800465e-2 weak           cohen1988
#> 4 Upper CI 7.843628180e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.831152229e+1
#> 2 logLik         3.969298039e+4
#> 3 AIC           -7.934615251e+4
#> 4 BIC           -7.919024958e+4
#> 5 deviance       1.837032349e+4
#> 6 df.residual    1.861468848e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  7.160714322e-2
#> 9 npar           2          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(57.251) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>               Estimate Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.9420231  0.0371683 -52.24944 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df    Chi.sq     p-value    
#> s(spei_12m)       2.11088702959 2.689219   6.66103    0.061442 .  
#> s(gdp_per_capita) 7.68632005188 8.528509 246.95261  < 2.22e-16 ***
#> s(year)           0.00003913388 1.000000   0.00059 0.000081652 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.121   Deviance explained = 11.1%
#> -REML = -4420.4  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1206707823  weak           cohen1988
#> 2 SE       0.01158457389 <NA>           <NA>     
#> 3 Lower CI 0.09796543472 weak           cohen1988
#> 4 Upper CI 0.1433761299  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.079724622e+1
#> 2 logLik         4.449238644e+3
#> 3 AIC           -8.872041678e+3
#> 4 BIC           -8.794861175e+3
#> 5 deviance       2.490273656e+3
#> 6 df.residual    2.527202754e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.206707823e-1
#> 9 npar           2          e+1
Code
beipr_gam_1_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 167: Value of the coefficients in the beipr_gam_1_by_misfs model.
A B C D
[Mean] -0.1409376509 -0.1546389653 -0.3440311558 -0.2527573118
(Intercept) -2.6518571118 -2.8547084085 -2.5111523048 -1.9420231027
mean(s(spei_12m)) -0.0182165492 -0.0144422976 -0.0118655437 -0.0064051561
mean(s(gdp_per_capita)) -0.0003274917 -0.0120100365 -0.4736312245 -0.3394974630
mean(s(year)) 0.0000004614 0.0000001085 0.0000001021 0.0000004395

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 189: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_beipr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.655) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.93257846  0.02271077 -85.09524 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df    Chi.sq       p-value    
#> s(spei_12m)       3.42848021188 4.316045  37.04845 0.00000045315 ***
#> s(gdp_per_capita) 8.14470663511 8.794077 127.90062    < 2.22e-16 ***
#> s(year)           0.00001166075 1.000000   0.00170    < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0317   Deviance explained = 2.04%
#> -REML = -9131.6  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.171548474e-2 weak           cohen1988
#> 2 SE       3.869202535e-3 <NA>           <NA>     
#> 3 Lower CI 2.413198712e-2 weak           cohen1988
#> 4 Upper CI 3.929898236e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.257319851e+1
#> 2 logLik         9.164375876e+3
#> 3 AIC           -1.829853146e+4
#> 4 BIC           -1.819439764e+4
#> 5 deviance       7.104669417e+3
#> 6 df.residual    7.258426801e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  3.171548474e-2
#> 9 npar           2          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.785) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.211168972  0.007619051 -290.2158 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       5.014045657309 6.164648  86.90427 < 2.22e-16 ***
#> s(gdp_per_capita) 8.584881359620 8.943785 364.57630 < 2.22e-16 ***
#> s(year)           0.000003923522 1.000000   0.00067 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00542   Deviance explained =  1.5%
#> -REML = -40828  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       5.420143243e-3 very weak (negligible) cohen1988
#> 2 SE       8.219347763e-4 <NA>                   <NA>     
#> 3 Lower CI 3.809180684e-3 very weak (negligible) cohen1988
#> 4 Upper CI 7.031105802e-3 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.459893094e+1
#> 2 logLik         4.087086004e+4
#> 3 AIC           -8.170818123e+4
#> 4 BIC           -8.156938733e+4
#> 5 deviance       2.914897765e+4
#> 6 df.residual    2.903040107e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  5.420143243e-3
#> 9 npar           2          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(33.992) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.78883251  0.01398642 -127.8979 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df    Chi.sq      p-value    
#> s(spei_12m)       8.56916723716 8.948355 110.67072   < 2.22e-16 ***
#> s(gdp_per_capita) 8.87477219826 8.995034 668.39868   < 2.22e-16 ***
#> s(year)           0.00001452181 1.000000   0.00031 0.0000042037 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0706   Deviance explained = 5.89%
#> -REML = -27025  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       7.056625750e-2 weak           cohen1988
#> 2 SE       3.462779580e-3 <NA>           <NA>     
#> 3 Lower CI 6.377933424e-2 weak           cohen1988
#> 4 Upper CI 7.735318077e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.844395396e+1
#> 2 logLik         2.708600770e+4
#> 3 AIC           -5.413215531e+4
#> 4 BIC           -5.397604944e+4
#> 5 deviance       1.818590945e+4
#> 6 df.residual    1.861455605e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  7.056625750e-2
#> 9 npar           2          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.729) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.27696464  0.01671877 -76.37913 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       1.003995035362 1.007977   7.70323  0.0056066 ** 
#> s(gdp_per_capita) 8.035081674469 8.732283 312.47450 < 2.22e-16 ***
#> s(year)           0.000004297156 1.000000   0.00000  0.5280488    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.138   Deviance explained = 13.6%
#> -REML = -2910.4  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1376428267  moderate       cohen1988
#> 2 SE       0.01213365012 <NA>           <NA>     
#> 3 Lower CI 0.1138613094  weak           cohen1988
#> 4 Upper CI 0.1614243439  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.003908101e+1
#> 2 logLik         2.939160515e+3
#> 3 AIC           -5.855273924e+3
#> 4 BIC           -5.787986380e+3
#> 5 deviance       2.466337895e+3
#> 6 df.residual    2.527960919e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.376428267e-1
#> 9 npar           2          e+1
Code
mbepr_beipr_gam_1_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 168: Value of the coefficients in the mbepr_beipr_gam_1_by_misfs model.
A B C D
[Mean] -0.0880911859 -0.1136614951 -0.3539310117 -0.4014485517
(Intercept) -1.9325784643 -2.2111689717 -1.7888325091 -1.2769646427
mean(s(spei_12m)) 0.0057724696 0.0172598259 -0.0186608780 0.0029059069
mean(s(gdp_per_capita)) 0.0132002314 -0.0241554939 -0.5690933268 -0.7531288403
mean(s(year)) 0.0000004385 0.0000000817 0.0000001189 0.0000000091

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
#> Warning: Removed 500 rows containing missing values or values outside the scale range
#> (`geom_line()`).
#> Warning in max(ids, na.rm = TRUE): no non-missing arguments to max;
#> returning -Inf
Figure 190: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.788) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>               Estimate Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.5356317  0.0158056 -223.6948 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                            edf   Ref.df   Chi.sq      p-value    
#> s(spei_12m)       4.5893046096 5.706236 38.24618 0.0000033879 ***
#> s(gdp_per_capita) 1.0317601522 1.062841 23.44288 0.0000024605 ***
#> s(year)           0.0000023952 1.000000  0.00002    0.0079066 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00251   Deviance explained = 0.855%
#> -REML = -19053  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.510767999e-3 very weak (negligible) cohen1988
#> 2 SE       1.121487168e-3 <NA>                   <NA>     
#> 3 Lower CI 3.126935414e-4 very weak (negligible) cohen1988
#> 4 Upper CI 4.708842457e-3 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.621067157e+0
#> 2 logLik         1.906999933e+4
#> 3 AIC           -3.812246049e+4
#> 4 BIC           -3.806202705e+4
#> 5 deviance       7.720296853e+3
#> 6 df.residual    7.264378933e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  2.510767999e-3
#> 9 npar           2          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.131) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.972477788  0.008077985 -491.7659 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.268887699852 8.857245 387.99400 < 2.22e-16 ***
#> s(gdp_per_capita) 8.757532927345 8.980289 625.05095 < 2.22e-16 ***
#> s(year)           0.000002009526 1.000000   0.00032 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0176   Deviance explained = 2.89%
#> -REML = -96217  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.757998579e-2 very weak (negligible) cohen1988
#> 2 SE       1.462173054e-3 <NA>                   <NA>     
#> 3 Lower CI 1.471417927e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.044579232e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.802642264e+1
#> 2 logLik         9.627230596e+4
#> 3 AIC           -1.925049368e+5
#> 4 BIC           -1.923407494e+5
#> 5 deviance       3.130296675e+4
#> 6 df.residual    2.902697358e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  1.757998579e-2
#> 9 npar           2          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(53.326) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.416535448  0.006704826 -509.5636 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                               edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)       7.4054453196514 8.391900 117.80611 < 2e-16 ***
#> s(gdp_per_capita) 7.5742349443957 8.479155  95.62161 < 2e-16 ***
#> s(year)           0.0000008288421 1.000000   0.00000 0.46555    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.012   Deviance explained = 1.41%
#> -REML = -47083  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.203325991e-2 very weak (negligible) cohen1988
#> 2 SE       1.519993892e-3 <NA>                   <NA>     
#> 3 Lower CI 9.054126623e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.501239320e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.597968109e+1
#> 2 logLik         4.712419551e+4
#> 3 AIC           -9.421227623e+4
#> 4 BIC           -9.407083823e+4
#> 5 deviance       1.837882892e+4
#> 6 df.residual    1.861702032e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.203325991e-2
#> 9 npar           2          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(88.727) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.52935083  0.03553781 -99.31256 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df   Chi.sq      p-value    
#> s(spei_12m)       1.00564979661 1.011276  0.19445      0.66188    
#> s(gdp_per_capita) 2.51292258833 3.079325 30.39445 0.0000017258 ***
#> s(year)           0.00001868132 1.000000  0.00034 0.0000140167 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0114   Deviance explained = 1.52%
#> -REML = -6989.5  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.136599182e-2 very weak (negligible) cohen1988
#> 2 SE       3.997299703e-3 <NA>                   <NA>     
#> 3 Lower CI 3.531428370e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.920055527e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             4.518591066e+0
#> 2 logLik         7.002134517e+3
#> 3 AIC           -1.399208776e+4
#> 4 BIC           -1.395652373e+4
#> 5 deviance       2.482532032e+3
#> 6 df.residual    2.533481409e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.136599182e-2
#> 9 npar           2          e+1
Code
maper_gam_1_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 169: Value of the coefficients in the maper_gam_1_by_misfs model.
A B C D
[Mean] -0.1685132319 -0.2808048715 -0.2458539480 -0.1990209933
(Intercept) -3.5356316830 -3.9724777883 -3.4165354476 -3.5293508271
mean(s(spei_12m)) 0.0241968394 -0.0603534674 -0.0383885557 0.0005774613
mean(s(gdp_per_capita)) -0.0058227261 -0.1222709431 -0.1283385011 -0.0506962091
mean(s(year)) 0.0000000245 0.0000000534 -0.0000000015 -0.0000003081

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 191: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mpepr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(31.492) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error  z value   Pr(>|z|)    
#> (Intercept) -3.42171787  0.02200123 -155.524 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df   Chi.sq     p-value    
#> s(spei_12m)       4.901310949050 6.062783 97.02856  < 2.22e-16 ***
#> s(gdp_per_capita) 1.006806659711 1.013579 18.57059 0.000017802 ***
#> s(year)           0.000007798031 1.000000  0.00044  < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00426   Deviance explained =  1.5%
#> -REML = -17852  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.908125407e+0
#> 2 logLik         1.786925380e+4
#> 3 AIC           -3.572035485e+4
#> 4 BIC           -3.565780364e+4
#> 5 deviance       7.697729939e+3
#> 6 df.residual    7.264091875e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.262616913e-3
#> 9 npar           2          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(27.018) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.756149891  0.007929237 -473.7088 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.73936069544 8.980595 669.27120 < 2.22e-16 ***
#> s(gdp_per_capita) 8.81134347763 8.987925 620.74023 < 2.22e-16 ***
#> s(year)           0.00000223106 1.000000   0.00085 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0183   Deviance explained = 3.62%
#> -REML = -83726  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.834240151e-2 very weak (negligible) cohen1988
#> 2 SE       1.492383522e-3 <NA>                   <NA>     
#> 3 Lower CI 1.541738355e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.126741946e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.855070640e+1
#> 2 logLik         8.378651351e+4
#> 3 AIC           -1.675330900e+5
#> 4 BIC           -1.673678184e+5
#> 5 deviance       3.189575842e+4
#> 6 df.residual    2.902644929e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  1.834240151e-2
#> 9 npar           2          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(91.848) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.339089402  0.008509168 -392.4108 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df   Chi.sq p-value    
#> s(spei_12m)       6.891909534387 8.004560 280.0341 < 2e-16 ***
#> s(gdp_per_capita) 8.237933381112 8.833265 317.3883 < 2e-16 ***
#> s(year)           0.000003678689 1.000000   0.0000 0.70503    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0283   Deviance explained = 2.71%
#> -REML = -49444  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.832588693e-2 weak           cohen1988
#> 2 SE       2.293613632e-3 <NA>           <NA>     
#> 3 Lower CI 2.383048681e-2 weak           cohen1988
#> 4 Upper CI 3.282128704e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.612984659e+1
#> 2 logLik         4.948834438e+4
#> 3 AIC           -9.894100828e+4
#> 4 BIC           -9.880127123e+4
#> 5 deviance       1.849755522e+4
#> 6 df.residual    1.861687015e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  2.832588693e-2
#> 9 npar           2          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(117.87) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.32148211  0.03506225 -94.73099 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       1.00549632000 1.010968  0.27960 0.60056231    
#> s(gdp_per_capita) 3.13582851928 3.835153 19.32045 0.00079322 ***
#> s(year)           0.00002728347 1.000000  0.00005 0.17655944    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00716   Deviance explained = 0.87%
#> -REML = -6953.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       7.162192381e-3 very weak (negligible) cohen1988
#> 2 SE       3.186609114e-3 <NA>                   <NA>     
#> 3 Lower CI 9.165532851e-4 very weak (negligible) cohen1988
#> 4 Upper CI 1.340783148e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             5.141352123e+0
#> 2 logLik         6.967705233e+3
#> 3 AIC           -1.392171812e+4
#> 4 BIC           -1.388174240e+4
#> 5 deviance       2.496202603e+3
#> 6 df.residual    2.532858648e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  7.162192381e-3
#> 9 npar           2          e+1
Code
mpepr_gam_1_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 170: Value of the coefficients in the mpepr_gam_1_by_misfs model.
A B C D
[Mean] -0.1682457248 -0.2936806231 -0.1928735196 -0.1780537093
(Intercept) -3.4217178726 -3.7561498915 -3.3390894022 -3.3214821061
mean(s(spei_12m)) 0.0110289389 -0.0694069958 0.0372264957 -0.0005493428
mean(s(gdp_per_capita)) -0.0047174756 -0.1658666328 -0.0948243838 -0.0260719865
mean(s(year)) 0.0000002064 0.0000000870 0.0000000027 -0.0000001162

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 192: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_1_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = 're'))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_mpepr_gam_1_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.016) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.74708724  0.02208828 -124.3685 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       4.356448950241 5.432914 81.01741 < 2.22e-16 ***
#> s(gdp_per_capita) 6.686677834810 7.786549 85.81369 < 2.22e-16 ***
#> s(year)           0.000008411868 1.000000  0.00008  0.0018389 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0107   Deviance explained = 2.14%
#> -REML = -13503  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.068843752e-2 very weak (negligible) cohen1988
#> 2 SE       2.294948777e-3 <NA>                   <NA>     
#> 3 Lower CI 6.190420575e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.518645447e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.204313520e+1
#> 2 logLik         1.353128848e+4
#> 3 AIC           -2.703213800e+4
#> 4 BIC           -2.692725068e+4
#> 5 deviance       7.330433443e+3
#> 6 df.residual    7.258956865e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  1.068843752e-2
#> 9 npar           2          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.319) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.147149555  0.007875411 -399.6172 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                              edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.715106867971 8.976908 538.95271 < 2.22e-16 ***
#> s(gdp_per_capita) 8.839999026864 8.991296 946.61224 < 2.22e-16 ***
#> s(year)           0.000002489889 1.000000   0.00071 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0306   Deviance explained = 4.29%
#> -REML = -64333  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.059080760e-2 weak           cohen1988
#> 2 SE       1.903245973e-3 <NA>           <NA>     
#> 3 Lower CI 2.686051404e-2 weak           cohen1988
#> 4 Upper CI 3.432110116e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.855510838e+1
#> 2 logLik         6.439471404e+4
#> 3 AIC           -1.287494917e+5
#> 4 BIC           -1.285842227e+5
#> 5 deviance       3.096481031e+4
#> 6 df.residual    2.902644489e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  3.059080760e-2
#> 9 npar           2          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(49.428) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.64745440  0.01338266 -197.8273 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.09881348326 8.169223 150.60108 < 2.22e-16 ***
#> s(gdp_per_capita) 8.23818405264 8.834190 330.69599 < 2.22e-16 ***
#> s(year)           0.00001039964 1.000000   0.00019 0.00001504 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0266   Deviance explained = 2.79%
#> -REML = -37690  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.659238110e-2 weak           cohen1988
#> 2 SE       2.226287378e-3 <NA>           <NA>     
#> 3 Lower CI 2.222893802e-2 weak           cohen1988
#> 4 Upper CI 3.095582418e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.633700794e+1
#> 2 logLik         3.773401075e+4
#> 3 AIC           -7.543194088e+4
#> 4 BIC           -7.529063673e+4
#> 5 deviance       1.823814964e+4
#> 6 df.residual    1.861666299e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  2.659238110e-2
#> 9 npar           2          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(62.45) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + s(year, bs = "re")
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.69322922  0.03597916 -74.85526 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                             edf   Ref.df   Chi.sq     p-value    
#> s(spei_12m)       1.00292377092 1.005840  0.01478     0.91504    
#> s(gdp_per_capita) 3.03758135292 3.716898 31.89257 0.000001759 ***
#> s(year)           0.00002696957 1.000000  0.00049 0.000012732 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0128   Deviance explained = 1.51%
#> -REML = -5427.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.278503174e-2 very weak (negligible) cohen1988
#> 2 SE       4.233408063e-3 <NA>                   <NA>     
#> 3 Lower CI 4.487704400e-3 very weak (negligible) cohen1988
#> 4 Upper CI 2.108235907e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             5.040532093e+0
#> 2 logLik         5.441295424e+3
#> 3 AIC           -1.086914527e+4
#> 4 BIC           -1.082989001e+4
#> 5 deviance       2.486096642e+3
#> 6 df.residual    2.532959468e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.278503174e-2
#> 9 npar           2          e+1
Code
maper_mpepr_gam_1_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 171: Value of the coefficients in the maper_mpepr_gam_1_by_misfs model.
A B C D
[Mean] -0.1678638760 -0.2623331824 -0.1531003304 -0.1482940759
(Intercept) -2.7470872445 -3.1471495549 -2.6474544033 -2.6932292198
mean(s(spei_12m)) 0.0212007584 -0.0492554517 0.0793634771 0.0001434907
mean(s(gdp_per_capita)) -0.0889996881 -0.1840239011 -0.1254248235 -0.0304381481
mean(s(year)) 0.0000000907 0.0000000809 -0.0000000874 -0.0000003822

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_1_by_misfs,
    type = 1,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 193: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_1_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + s(gdp_per_capita) + year (Ordered year)

In this model, the year variable is treated as a ordered categorical variable.

.L, .Q, and .C are, respectively, the coefficients for the ordered factor coded with linear, quadratic, and cubic contrasts.

Code
mbepr_gam_2_by_misfs <-
  data |>
  gam_misfs(mbepr ~ s(spei_12m) + s(gdp_per_capita) + year)
data |>
  summarise_gam_misfs(mbepr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.243) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.783316502  0.009229724 -301.56010 < 2.22e-16 ***
#> year.L       0.585106184  0.046026702   12.71232 < 2.22e-16 ***
#> year.Q      -0.270247643  0.033412257   -8.08828 6.0514e-16 ***
#> year.C       0.064478614  0.031774257    2.02927 0.04243058 *  
#> year^4      -0.018437103  0.033037270   -0.55807 0.57679672    
#> year^5       0.154502582  0.038834044    3.97853 6.9341e-05 ***
#> year^6      -0.129285332  0.035011959   -3.69260 0.00022197 ***
#> year^7       0.030317969  0.031538419    0.96130 0.33639998    
#> year^8       0.011989720  0.031318674    0.38283 0.70184601    
#> year^9      -0.070206738  0.032468993   -2.16227 0.03059735 *  
#> year^10     -0.094562752  0.030479180   -3.10254 0.00191870 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq  p-value    
#> s(spei_12m)       4.213269 5.321403  19.62633 0.002229 ** 
#> s(gdp_per_capita) 7.983053 8.718735 136.86642  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0043   Deviance explained = 4.84%
#> -REML = -13461  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.319632186e+1
#> 2 logLik         1.351835954e+4
#> 3 AIC           -2.698515574e+4
#> 4 BIC           -2.680747751e+4
#> 5 deviance       7.443829780e+3
#> 6 df.residual    7.247803678e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.304359701e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.174) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value       Pr(>|z|)    
#> (Intercept) -3.085701791  0.005066000 -609.10018     < 2.22e-16 ***
#> year.L       0.256712505  0.023235181   11.04844     < 2.22e-16 ***
#> year.Q      -0.295700427  0.017609063  -16.79251     < 2.22e-16 ***
#> year.C       0.001991815  0.017091874    0.11654      0.9072279    
#> year^4      -0.052348046  0.017679257   -2.96099      0.0030666 ** 
#> year^5       0.072388339  0.018025970    4.01578 0.000059249400 ***
#> year^6      -0.058549096  0.019158522   -3.05603      0.0022429 ** 
#> year^7       0.056179019  0.017951308    3.12952      0.0017509 ** 
#> year^8       0.035104454  0.017349330    2.02339      0.0430330 *  
#> year^9      -0.102398129  0.018149167   -5.64203 0.000000016806 ***
#> year^10      0.055423082  0.018618120    2.97684      0.0029124 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       8.332668 8.882537 131.9754 < 2.22e-16 ***
#> s(gdp_per_capita) 8.666506 8.963381 511.9798 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00906   Deviance explained = 3.19%
#> -REML = -62820  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.799917357e+1
#> 2 logLik         6.290498951e+4
#> 3 AIC           -1.257502872e+5
#> 4 BIC           -1.255032644e+5
#> 5 deviance       3.063357529e+4
#> 6 df.residual    2.901700083e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -9.063547776e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(40.229) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value     Pr(>|z|)    
#> (Intercept) -2.618157766  0.004209328 -621.98944   < 2.22e-16 ***
#> year.L      -0.006891703  0.031324953   -0.22001   0.82586585    
#> year.Q       0.033355002  0.017496064    1.90643   0.05659458 .  
#> year.C       0.022489152  0.015636385    1.43826   0.15036093    
#> year^4      -0.042700954  0.015633174   -2.73143   0.00630597 ** 
#> year^5       0.056556444  0.015920777    3.55237   0.00038178 ***
#> year^6      -0.043163882  0.017829168   -2.42097   0.01547915 *  
#> year^7       0.030243496  0.015136412    1.99806   0.04570989 *  
#> year^8       0.090965618  0.022111232    4.11400 0.0000388861 ***
#> year^9      -0.089787710  0.017633080   -5.09200 0.0000003543 ***
#> year^10     -0.022125926  0.014467788   -1.52932   0.12618431    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.162494 8.819018  60.96357 < 2.22e-16 ***
#> s(gdp_per_capita) 8.797123 8.987155 235.09336 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.042   Deviance explained = 3.41%
#> -REML = -35898  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.201543224e-2 weak           cohen1988
#> 2 SE       2.754043533e-3 <NA>           <NA>     
#> 3 Lower CI 3.661760610e-2 weak           cohen1988
#> 4 Upper CI 4.741325838e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.795961713e+1
#> 2 logLik         3.598537166e+4
#> 3 AIC           -7.191113097e+4
#> 4 BIC           -7.167766848e+4
#> 5 deviance       1.812816377e+4
#> 6 df.residual    1.860504038e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.201543224e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(37.383) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.28719843  0.01052534 -217.30391 < 2.22e-16 ***
#> year.L      -0.05181967  0.04584864   -1.13023  0.2583778    
#> year.Q       0.04350822  0.03891154    1.11813  0.2635109    
#> year.C      -0.02620339  0.03905398   -0.67095  0.5022503    
#> year^4       0.02524931  0.03527213    0.71584  0.4740883    
#> year^5       0.05682770  0.03899065    1.45747  0.1449867    
#> year^6      -0.10874928  0.03558879   -3.05572  0.0022452 ** 
#> year^7       0.06490335  0.03592519    1.80663  0.0708207 .  
#> year^8       0.10880219  0.03586327    3.03381  0.0024149 ** 
#> year^9      -0.11798075  0.03987974   -2.95841  0.0030923 ** 
#> year^10     -0.01933468  0.03759919   -0.51423  0.6070904    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)       2.513916 3.221126   2.40512 0.45777    
#> s(gdp_per_capita) 7.252433 8.226255 137.33956 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0877   Deviance explained = 10.8%
#> -REML =  -4341  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.08772279128 weak           cohen1988
#> 2 SE       0.01024732575 <NA>           <NA>     
#> 3 Lower CI 0.06763840187 weak           cohen1988
#> 4 Upper CI 0.1078071807  weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.076634920e+1
#> 2 logLik         4.391636743e+3
#> 3 AIC           -8.736378724e+3
#> 4 BIC           -8.599466376e+3
#> 5 deviance       2.448497468e+3
#> 6 df.residual    2.517233651e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  8.772279128e-2
#> 9 npar           2.9        e+1
Code
mbepr_gam_2_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 172: Value of the coefficients in the mbepr_gam_2_by_misfs model.
A B C D
[Mean] -0.0762934319 -0.1210631041 -0.2680437423 -0.3958672150
(Intercept) -2.7833165024 -3.0857017913 -2.6181577659 -2.2871984262
year.L 0.5851061842 0.2567125050 -0.0068917029 -0.0518196743
year.Q -0.2702476434 -0.2957004271 0.0333550018 0.0435082161
year.C 0.0644786140 0.0019918154 0.0224891521 -0.0262033933
year^4 -0.0184371026 -0.0523480462 -0.0427009535 0.0252493068
year^5 0.1545025819 0.0723883394 0.0565564438 0.0568277022
year^6 -0.1292853321 -0.0585490961 -0.0431638824 -0.1087492821
year^7 0.0303179685 0.0561790187 0.0302434962 0.0649033490
year^8 0.0119897197 0.0351044545 0.0909656185 0.1088021901
year^9 -0.0702067375 -0.1023981295 -0.0897877095 -0.1179807511
year^10 -0.0945627517 0.0554230824 -0.0221259262 -0.0193346752
mean(s(spei_12m)) -0.0171356472 0.0117758792 -0.0076226432 0.0017440117
mean(s(gdp_per_capita)) 0.0512635891 -0.0555460728 -0.5683829455 -1.0204277669

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 194: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_2_by_misfs <-
  data |>
  gam_misfs(beipr ~ s(spei_12m) + s(gdp_per_capita) + year)
data |>
  summarise_gam_misfs(beipr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.645) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value      Pr(>|z|)    
#> (Intercept) -2.662751589  0.008033784 -331.44425    < 2.22e-16 ***
#> year.L       0.658078337  0.040334652   16.31546    < 2.22e-16 ***
#> year.Q      -0.153590318  0.029085699   -5.28061 0.00000012875 ***
#> year.C      -0.031960277  0.027562628   -1.15955     0.2462316    
#> year^4       0.042970181  0.028752331    1.49449     0.1350466    
#> year^5       0.051616176  0.034503033    1.49599     0.1346564    
#> year^6      -0.098671768  0.030880144   -3.19531     0.0013968 ** 
#> year^7      -0.031043600  0.027523614   -1.12789     0.2593665    
#> year^8       0.049196052  0.027718704    1.77483     0.0759256 .  
#> year^9       0.013720073  0.028706116    0.47795     0.6326862    
#> year^10      0.024197231  0.026936913    0.89829     0.3690295    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                       edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       5.66093 6.914622  27.08158 0.00027339 ***
#> s(gdp_per_capita) 8.53392 8.934795 204.07291 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0241   Deviance explained = 5.81%
#> -REML = -13221  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.413974465e-2 weak                   cohen1988
#> 2 SE       3.402019249e-3 <NA>                   <NA>     
#> 3 Lower CI 1.747190945e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.080757986e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.519484923e+1
#> 2 logLik         1.328709678e+4
#> 3 AIC           -2.651901920e+4
#> 4 BIC           -2.632889805e+4
#> 5 deviance       7.384862076e+3
#> 6 df.residual    7.245805151e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  2.413974465e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.383) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value        Pr(>|z|)    
#> (Intercept) -2.859734521  0.004376121 -653.48617      < 2.22e-16 ***
#> year.L       0.319243545  0.020020539   15.94580      < 2.22e-16 ***
#> year.Q      -0.134887648  0.015173725   -8.88955      < 2.22e-16 ***
#> year.C      -0.041754244  0.014745325   -2.83169      0.00463022 ** 
#> year^4      -0.034909283  0.015207197   -2.29558      0.02170011 *  
#> year^5       0.064729296  0.015535464    4.16655 0.0000309243264 ***
#> year^6      -0.061155288  0.016530673   -3.69950      0.00021602 ***
#> year^7       0.021920059  0.015419262    1.42160      0.15514172    
#> year^8       0.040630638  0.015044203    2.70075      0.00691833 ** 
#> year^9      -0.052646878  0.015724256   -3.34813      0.00081358 ***
#> year^10      0.094261300  0.016126004    5.84530 0.0000000050566 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.010772 8.752246  66.94599 < 2.22e-16 ***
#> s(gdp_per_capita) 8.679349 8.966034 524.44912 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0314   Deviance explained =  3.1%
#> -REML = -56532  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.769012098e+1
#> 2 logLik         5.661758801e+4
#> 3 AIC           -1.131757395e+5
#> 4 BIC           -1.129297731e+5
#> 5 deviance       3.031701357e+4
#> 6 df.residual    2.901730988e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -3.144979397e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(75.981) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -2.511663742  0.003066312 -819.11559         < 2.22e-16 ***
#> year.L       0.123671378  0.022958131    5.38682 0.0000000717141373 ***
#> year.Q       0.071346920  0.012745551    5.59779 0.0000000217101377 ***
#> year.C      -0.005697127  0.011409574   -0.49933           0.617548    
#> year^4      -0.023796490  0.011394602   -2.08840           0.036762 *  
#> year^5       0.006420962  0.011575740    0.55469           0.579106    
#> year^6      -0.091815115  0.012971250   -7.07836 0.0000000000014588 ***
#> year^7       0.012920365  0.010988564    1.17580           0.239674    
#> year^8       0.068283787  0.016143760    4.22973 0.0000233969194195 ***
#> year^9      -0.018453499  0.012879825   -1.43274           0.151931    
#> year^10      0.041276743  0.010589871    3.89776 0.0000970877865959 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.397573 8.903406  65.41918 < 2.22e-16 ***
#> s(gdp_per_capita) 8.899197 8.996804 637.63411 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0809   Deviance explained = 6.05%
#> -REML = -39713  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       8.089570581e-2 weak           cohen1988
#> 2 SE       3.666362476e-3 <NA>           <NA>     
#> 3 Lower CI 7.370976740e-2 weak           cohen1988
#> 4 Upper CI 8.808164422e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.829676986e+1
#> 2 logLik         3.980828045e+4
#> 3 AIC           -7.955676047e+4
#> 4 BIC           -7.932256141e+4
#> 5 deviance       1.836583071e+4
#> 6 df.residual    1.860470323e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  8.089570581e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(57.883) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value    Pr(>|z|)    
#> (Intercept) -1.942409649  0.007664525 -253.42859  < 2.22e-16 ***
#> year.L       0.137213872  0.034119652    4.02155 0.000057817 ***
#> year.Q      -0.037987379  0.028763563   -1.32068    0.186609    
#> year.C       0.033125217  0.028548088    1.16033    0.245914    
#> year^4      -0.031590691  0.025861863   -1.22152    0.221891    
#> year^5       0.015382103  0.028377902    0.54205    0.587787    
#> year^6      -0.057862065  0.025969076   -2.22811    0.025873 *  
#> year^7       0.038112616  0.026103459    1.46006    0.144274    
#> year^8       0.026938346  0.026120003    1.03133    0.302386    
#> year^9      -0.004481966  0.028839435   -0.15541    0.876497    
#> year^10     -0.002943281  0.027488097   -0.10707    0.914730    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq  p-value    
#> s(spei_12m)       2.672467 3.419177   9.52419 0.031068 *  
#> s(gdp_per_capita) 8.158620 8.794660 242.51498  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.123   Deviance explained = 12.4%
#> -REML = -4408.6  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1232997714  weak           cohen1988
#> 2 SE       0.01167507694 <NA>           <NA>     
#> 3 Lower CI 0.1004170411  weak           cohen1988
#> 4 Upper CI 0.1461825018  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.183108776e+1
#> 2 logLik         4.467818979e+3
#> 3 AIC           -8.887360976e+3
#> 4 BIC           -8.746413152e+3
#> 5 deviance       2.480929226e+3
#> 6 df.residual    2.516168912e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.232997714e-1
#> 9 npar           2.9        e+1
Code
beipr_gam_2_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 173: Value of the coefficients in the beipr_gam_2_by_misfs model.
A B C D
[Mean] -0.0610390985 -0.1005381217 -0.2450296481 -0.2522643755
(Intercept) -2.6627515887 -2.8597345212 -2.5116637422 -1.9424096487
year.L 0.6580783368 0.3192435445 0.1236713781 0.1372138716
year.Q -0.1535903182 -0.1348876475 0.0713469204 -0.0379873788
year.C -0.0319602766 -0.0417542439 -0.0056971267 0.0331252168
year^4 0.0429701806 -0.0349092831 -0.0237964900 -0.0315906905
year^5 0.0516161764 0.0647292959 0.0064209625 0.0153821031
year^6 -0.0986717683 -0.0611552876 -0.0918151146 -0.0578620645
year^7 -0.0310435999 0.0219200593 0.0129203654 0.0381126159
year^8 0.0491960520 0.0406306375 0.0682837874 0.0269383456
year^9 0.0137200727 -0.0526468777 -0.0184534990 -0.0044819657
year^10 0.0241972313 0.0942613000 0.0412767425 -0.0029432810
mean(s(spei_12m)) -0.0293562426 -0.0123000663 -0.0130620883 -0.0157785180
mean(s(gdp_per_capita)) 0.0702568698 -0.0178446565 -0.5178661314 -0.5941285946

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 195: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_2_by_misfs <-
  data |>
  gam_misfs(mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year)
data |>
  summarise_gam_misfs(mbepr_beipr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.267) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -1.939366580  0.007511323 -258.19242       < 2.22e-16 ***
#> year.L       0.468207179  0.037382429   12.52479       < 2.22e-16 ***
#> year.Q      -0.173701269  0.027016624   -6.42942 0.00000000012809 ***
#> year.C       0.017294488  0.025649233    0.67427       0.50014017    
#> year^4       0.023163104  0.026697128    0.86763       0.38559948    
#> year^5       0.101654073  0.030324141    3.35225       0.00080158 ***
#> year^6      -0.112666955  0.028227765   -3.99135 0.00006569760936 ***
#> year^7       0.027145988  0.025436306    1.06721       0.28587511    
#> year^8       0.025951564  0.025383126    1.02239       0.30659431    
#> year^9      -0.049691189  0.026067108   -1.90628       0.05661397 .  
#> year^10     -0.042523641  0.024631624   -1.72638       0.08427836 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)       3.020606 3.879663   6.40391  0.2102    
#> s(gdp_per_capita) 8.578943 8.946782 297.75208  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0395   Deviance explained = 5.29%
#> -REML = -9222.2  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.951783790e-2 weak           cohen1988
#> 2 SE       4.284189687e-3 <NA>           <NA>     
#> 3 Lower CI 3.112098041e-2 weak           cohen1988
#> 4 Upper CI 4.791469539e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.259954856e+1
#> 2 logLik         9.284757045e+3
#> 3 AIC           -1.851986120e+4
#> 4 BIC           -1.834876605e+4
#> 5 deviance       7.108154908e+3
#> 6 df.residual    7.248400451e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  3.951783790e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.995) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value     Pr(>|z|)    
#> (Intercept) -2.213617891  0.004156974 -532.50707   < 2.22e-16 ***
#> year.L       0.193122378  0.018924770   10.20474   < 2.22e-16 ***
#> year.Q      -0.164257222  0.014298655  -11.48760   < 2.22e-16 ***
#> year.C      -0.008919064  0.013994962   -0.63731   0.52392598    
#> year^4      -0.022453820  0.014270733   -1.57342   0.11562218    
#> year^5       0.062069204  0.014687539    4.22598 0.0000237906 ***
#> year^6      -0.069054507  0.015485892   -4.45919 0.0000082271 ***
#> year^7       0.036450489  0.014271844    2.55401   0.01064890 *  
#> year^8       0.036683084  0.014122623    2.59747   0.00939134 ** 
#> year^9      -0.054772410  0.014781325   -3.70551   0.00021096 ***
#> year^10      0.051849250  0.015089810    3.43604   0.00059028 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq      p-value    
#> s(spei_12m)       4.541934 5.656737  34.66547 0.0000039428 ***
#> s(gdp_per_capita) 8.721479 8.974247 557.97287   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00315   Deviance explained = 2.67%
#> -REML = -40966  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.426341372e+1
#> 2 logLik         4.104214771e+4
#> 3 AIC           -8.203194150e+4
#> 4 BIC           -8.181528527e+4
#> 5 deviance       2.915430259e+4
#> 6 df.residual    2.902073659e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -3.151607063e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(34.171) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value        Pr(>|z|)    
#> (Intercept) -1.788667558  0.003424242 -522.35430      < 2.22e-16 ***
#> year.L      -0.009517005  0.025542439   -0.37260       0.7094493    
#> year.Q       0.089321476  0.014228559    6.27762 0.0000000003438 ***
#> year.C       0.016778113  0.012736974    1.31728       0.1877460    
#> year^4      -0.040804014  0.012726062   -3.20633       0.0013444 ** 
#> year^5       0.031141253  0.012949281    2.40486       0.0161785 *  
#> year^6      -0.072499625  0.014512368   -4.99571 0.0000005861877 ***
#> year^7       0.026333031  0.012309170    2.13930       0.0324112 *  
#> year^8       0.087796627  0.018033021    4.86866 0.0000011235815 ***
#> year^9      -0.050219673  0.014395458   -3.48858       0.0004856 ***
#> year^10      0.006297916  0.011821595    0.53275       0.5942089    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.562054 8.947813  97.68265 < 2.22e-16 ***
#> s(gdp_per_capita) 8.862406 8.994065 450.87895 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.075   Deviance explained = 6.43%
#> -REML = -27044  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       7.500488523e-2 weak           cohen1988
#> 2 SE       3.552974451e-3 <NA>           <NA>     
#> 3 Lower CI 6.804118327e-2 weak           cohen1988
#> 4 Upper CI 8.196858719e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.842446036e+1
#> 2 logLik         2.713838974e+4
#> 3 AIC           -5.421691429e+4
#> 4 BIC           -5.398246154e+4
#> 5 deviance       1.817912696e+4
#> 6 df.residual    1.860457554e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  7.500488523e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.853) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                  Estimate    Std. Error    z value   Pr(>|z|)    
#> (Intercept) -1.2772107657  0.0089833598 -142.17518 < 2.22e-16 ***
#> year.L       0.0119926417  0.0396178451    0.30271  0.7621123    
#> year.Q       0.0111362275  0.0332661952    0.33476  0.7378053    
#> year.C       0.0171028584  0.0326422174    0.52395  0.6003140    
#> year^4       0.0003162651  0.0296378062    0.01067  0.9914859    
#> year^5       0.0294287719  0.0326101164    0.90244  0.3668216    
#> year^6      -0.0842882184  0.0301334206   -2.79717  0.0051553 ** 
#> year^7       0.0553810097  0.0301724780    1.83548  0.0664345 .  
#> year^8       0.0665652652  0.0304665761    2.18486  0.0288990 *  
#> year^9      -0.0524509891  0.0336971480   -1.55654  0.1195795    
#> year^10     -0.0128174624  0.0300331402   -0.42678  0.6695415    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)       1.004184 1.008355   0.80454 0.37076    
#> s(gdp_per_capita) 8.074655 8.755006 230.86183 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =   0.14   Deviance explained = 14.3%
#> -REML = -2894.9  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1403277857  moderate       cohen1988
#> 2 SE       0.01221327742 <NA>           <NA>     
#> 3 Lower CI 0.1163902018  weak           cohen1988
#> 4 Upper CI 0.1642653696  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.007883926e+1
#> 2 logLik         2.949316369e+3
#> 3 AIC           -5.855448281e+3
#> 4 BIC           -5.729368413e+3
#> 5 deviance       2.457919422e+3
#> 6 df.residual    2.517921161e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.403277857e-1
#> 9 npar           2.9        e+1
Code
mbepr_beipr_gam_2_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 174: Value of the coefficients in the mbepr_beipr_gam_2_by_misfs model.
A B C D
[Mean] -0.0379331610 -0.0809146803 -0.2434751026 -0.3098402383
(Intercept) -1.9393665796 -2.2136178909 -1.7886675584 -1.2772107657
year.L 0.4682071788 0.1931223779 -0.0095170045 0.0119926417
year.Q -0.1737012693 -0.1642572218 0.0893214765 0.0111362275
year.C 0.0172944881 -0.0089190640 0.0167781131 0.0171028584
year^4 0.0231631039 -0.0224538203 -0.0408040144 0.0003162651
year^5 0.1016540734 0.0620692037 0.0311412534 0.0294287719
year^6 -0.1126669550 -0.0690545073 -0.0724996255 -0.0842882184
year^7 0.0271459875 0.0364504888 0.0263330311 0.0553810097
year^8 0.0259515636 0.0366830841 0.0877966272 0.0665652652
year^9 -0.0496911890 -0.0547724104 -0.0502196735 -0.0524509891
year^10 -0.0425236414 0.0518492498 0.0062979157 -0.0128174624
mean(s(spei_12m)) -0.0062429072 0.0214584160 -0.0329240654 0.0013366481
mean(s(gdp_per_capita)) 0.0678508593 -0.0429723293 -0.5622691030 -0.8625058164

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
#> Warning: Removed 500 rows containing missing values or values outside the scale range
#> (`geom_line()`).
#> Warning in max(ids, na.rm = TRUE): no non-missing arguments to max;
#> returning -Inf
Figure 196: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_2_by_misfs <-
  data |>
  gam_misfs(maper ~ s(spei_12m) + s(gdp_per_capita) + year)
data |>
  summarise_gam_misfs(maper_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.147) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.54107555  0.01022405 -346.34761         < 2.22e-16 ***
#> year.L       0.19394939  0.05086947    3.81269         0.00013746 ***
#> year.Q      -0.26225329  0.03687871   -7.11124 0.0000000000011501 ***
#> year.C      -0.05752936  0.03494836   -1.64612         0.09973804 .  
#> year^4      -0.05866581  0.03676100   -1.59587         0.11051761    
#> year^5      -0.05720787  0.04352848   -1.31426         0.18875773    
#> year^6       0.04818036  0.03927412    1.22677         0.21990854    
#> year^7       0.03962575  0.03491759    1.13484         0.25644387    
#> year^8       0.11637192  0.03464760    3.35873         0.00078302 ***
#> year^9      -0.06953381  0.03588885   -1.93748         0.05268708 .  
#> year^10     -0.02489812  0.03397401   -0.73286         0.46364503    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       4.247119 5.365345 17.64906  0.0048491 ** 
#> s(gdp_per_capita) 6.755200 7.847116 54.04785 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0047   Deviance explained =  2.2%
#> -REML = -19070  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.200231852e+1
#> 2 logLik         1.912192573e+4
#> 3 AIC           -3.819342653e+4
#> 4 BIC           -3.801967110e+4
#> 5 deviance       7.707238177e+3
#> 6 df.residual    7.248997681e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.700829275e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.738) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.982412344  0.005425053 -734.07810         < 2.22e-16 ***
#> year.L       0.222808885  0.024817947    8.97773         < 2.22e-16 ***
#> year.Q      -0.294794254  0.018815897  -15.66730         < 2.22e-16 ***
#> year.C      -0.118169058  0.018224533   -6.48407 0.0000000000892836 ***
#> year^4      -0.068367888  0.018932097   -3.61122         0.00030476 ***
#> year^5       0.108388987  0.019334298    5.60605 0.0000000206999638 ***
#> year^6      -0.026461247  0.020551314   -1.28757         0.19789581    
#> year^7       0.112840976  0.019240116    5.86488 0.0000000044945729 ***
#> year^8       0.091988899  0.018593875    4.94727 0.0000007526200916 ***
#> year^9      -0.099319882  0.019474071   -5.10011 0.0000003394583059 ***
#> year^10      0.139139088  0.020054271    6.93813 0.0000000000039733 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       8.556612 8.946522 321.4451 < 2.22e-16 ***
#> s(gdp_per_capita) 8.825283 8.989705 864.3839 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0134   Deviance explained = 4.75%
#> -REML = -96467  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.338691524e-2 very weak (negligible) cohen1988
#> 2 SE       1.281384430e-3 <NA>                   <NA>     
#> 3 Lower CI 1.087544791e-2 very weak (negligible) cohen1988
#> 4 Upper CI 1.589838258e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.838189508e+1
#> 2 logLik         9.655564883e+4
#> 3 AIC           -1.930514252e+5
#> 4 BIC           -1.928036550e+5
#> 5 deviance       3.127616722e+4
#> 6 df.residual    2.901661810e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  1.338691524e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(53.919) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value          Pr(>|z|)    
#> (Intercept) -3.418964243  0.004931357 -693.31109        < 2.22e-16 ***
#> year.L      -0.106646411  0.036004940   -2.96199        0.00305654 ** 
#> year.Q      -0.125409731  0.020354656   -6.16123 0.000000000721818 ***
#> year.C       0.033149457  0.018281480    1.81328        0.06978851 .  
#> year^4      -0.068833656  0.018317246   -3.75786        0.00017137 ***
#> year^5       0.122202158  0.018625444    6.56103 0.000000000053436 ***
#> year^6       0.022145551  0.020855409    1.06186        0.28829868    
#> year^7       0.005444664  0.017579170    0.30972        0.75677203    
#> year^8       0.117463911  0.025605619    4.58743 0.000004487421709 ***
#> year^9      -0.139077709  0.020277136   -6.85884 0.000000000006942 ***
#> year^10      0.030103417  0.016604375    1.81298        0.06983474 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.466508 8.445423 125.26600 < 2.22e-16 ***
#> s(gdp_per_capita) 8.170350 8.807415  94.89469 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0129   Deviance explained = 2.46%
#> -REML = -47148  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.286151339e-2 very weak (negligible) cohen1988
#> 2 SE       1.570116912e-3 <NA>                   <NA>     
#> 3 Lower CI 9.784140789e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.593888599e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.663685747e+1
#> 2 logLik         4.722342544e+4
#> 3 AIC           -9.438884293e+4
#> 4 BIC           -9.416166379e+4
#> 5 deviance       1.837359661e+4
#> 6 df.residual    1.860636314e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.286151339e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(90.209) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.532521982  0.011436983 -308.86836 < 2.22e-16 ***
#> year.L      -0.159253650  0.045477707   -3.50180 0.00046213 ***
#> year.Q      -0.122596136  0.041408766   -2.96063 0.00307008 ** 
#> year.C      -0.114564445  0.041546431   -2.75750 0.00582445 ** 
#> year^4       0.030453251  0.038149798    0.79825 0.42472277    
#> year^5       0.088111864  0.041664991    2.11477 0.03444958 *  
#> year^6      -0.008328661  0.038607134   -0.21573 0.82919935    
#> year^7       0.096667184  0.038332450    2.52181 0.01167525 *  
#> year^8      -0.006749917  0.038553545   -0.17508 0.86101755    
#> year^9      -0.032654209  0.042197713   -0.77384 0.43902639    
#> year^10      0.036410928  0.037573282    0.96906 0.33251308    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       1.011885 1.023682  0.58730 0.45441626    
#> s(gdp_per_capita) 1.951469 2.408008 16.40875 0.00055587 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0234   Deviance explained = 3.33%
#> -REML = -6990.3  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.339901231e-2 weak                   cohen1988
#> 2 SE       5.665567499e-3 <NA>                   <NA>     
#> 3 Lower CI 1.229470406e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.450332056e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.396335330e+1
#> 2 logLik         7.025127363e+3
#> 3 AIC           -1.401939135e+4
#> 4 BIC           -1.392928368e+4
#> 5 deviance       2.476938563e+3
#> 6 df.residual    2.524036647e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.339901231e-2
#> 9 npar           2.9        e+1
Code
maper_gam_2_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 175: Value of the coefficients in the maper_gam_2_by_misfs model.
A B C D
[Mean] -0.1546098852 -0.1910681006 -0.1937536269 -0.1421961029
(Intercept) -3.5410755525 -3.9824123436 -3.4189642434 -3.5325219821
year.L 0.1939493869 0.2228088848 -0.1066464112 -0.1592536498
year.Q -0.2622532913 -0.2947942537 -0.1254097313 -0.1225961365
year.C -0.0575293609 -0.1181690583 0.0331494572 -0.1145644448
year^4 -0.0586658142 -0.0683678878 -0.0688336556 0.0304532512
year^5 -0.0572078741 0.1083889875 0.1222021580 0.0881118637
year^6 0.0481803627 -0.0264612474 0.0221455508 -0.0083286610
year^7 0.0396257475 0.1128409758 0.0054446636 0.0966671844
year^8 0.1163719194 0.0919888989 0.1174639105 -0.0067499165
year^9 -0.0695338130 -0.0993198816 -0.1390777088 -0.0326542091
year^10 -0.0248981238 0.1391390877 0.0301034168 0.0364109280
mean(s(spei_12m)) 0.0239209369 -0.0457889341 -0.0420129688 0.0015068309
mean(s(gdp_per_capita)) -0.1139931878 -0.1349462968 -0.1902573186 -0.0458025210

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 197: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_2_by_misfs <-
  data |>
  gam_misfs(mpepr ~ s(spei_12m) + s(gdp_per_capita) + year)
data |>
  summarise_gam_misfs(mpepr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.574) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.431305902  0.009298401 -369.02105         < 2.22e-16 ***
#> year.L       0.418079843  0.046935346    8.90757         < 2.22e-16 ***
#> year.Q      -0.252878396  0.034066894   -7.42300 0.0000000000001145 ***
#> year.C      -0.071600888  0.031907177   -2.24404          0.0248300 *  
#> year^4      -0.100825588  0.033582783   -3.00230          0.0026795 ** 
#> year^5      -0.164835522  0.040304817   -4.08972 0.0000431889327845 ***
#> year^6       0.071949339  0.036133076    1.99123          0.0464554 *  
#> year^7      -0.062788395  0.031699556   -1.98073          0.0476211 *  
#> year^8       0.069605824  0.031909257    2.18137          0.0291562 *  
#> year^9      -0.082450811  0.032788930   -2.51459          0.0119170 *  
#> year^10      0.133889408  0.031315508    4.27550 0.0000190710043459 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       5.692085 6.957205  36.69025 < 2.22e-16 ***
#> s(gdp_per_capita) 8.181016 8.810878 117.03914 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0265   Deviance explained =  4.5%
#> -REML = -17923  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.487310079e+1
#> 2 logLik         1.798487580e+4
#> 3 AIC           -3.591421544e+4
#> 4 BIC           -3.572284756e+4
#> 5 deviance       7.684990495e+3
#> 6 df.residual    7.246126899e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -2.648334231e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(27.853) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.768191002  0.005164089 -729.69132         < 2.22e-16 ***
#> year.L       0.375575251  0.023642786   15.88541         < 2.22e-16 ***
#> year.Q      -0.159117052  0.017935146   -8.87180         < 2.22e-16 ***
#> year.C      -0.145041679  0.017292361   -8.38762         < 2.22e-16 ***
#> year^4      -0.165049430  0.017994398   -9.17227         < 2.22e-16 ***
#> year^5       0.084651155  0.018383852    4.60465 0.0000041316533234 ***
#> year^6       0.042189879  0.019525566    2.16075         0.03071461 *  
#> year^7       0.084183481  0.018268857    4.60803 0.0000040649773207 ***
#> year^8       0.079752657  0.017632727    4.52299 0.0000060972003636 ***
#> year^9      -0.069340864  0.018549111   -3.73823         0.00018532 ***
#> year^10      0.135114358  0.019235242    7.02431 0.0000000000021512 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       8.791883 8.987806 444.2199 < 2.22e-16 ***
#> s(gdp_per_capita) 8.839470 8.991264 932.8363 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00813   Deviance explained = 5.93%
#> -REML = -84053  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.132137454e-3 very weak (negligible) cohen1988
#> 2 SE       1.004034160e-3 <NA>                   <NA>     
#> 3 Lower CI 6.164266661e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.010000825e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.863135285e+1
#> 2 logLik         8.414638145e+4
#> 3 AIC           -1.682328048e+5
#> 4 BIC           -1.679846799e+5
#> 5 deviance       3.189865427e+4
#> 6 df.residual    2.901636865e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  8.132137454e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(93.143) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.34093609  0.00387263 -862.70473         < 2.22e-16 ***
#> year.L      -0.09915093  0.02831758   -3.50139         0.00046284 ***
#> year.Q      -0.07440449  0.01605759   -4.63360 0.0000035935712188 ***
#> year.C       0.09874149  0.01431219    6.89912 0.0000000000052326 ***
#> year^4      -0.12494085  0.01434959   -8.70693         < 2.22e-16 ***
#> year^5       0.05206759  0.01452172    3.58550         0.00033644 ***
#> year^6      -0.01687506  0.01626765   -1.03734         0.29957798    
#> year^7      -0.06053119  0.01376364   -4.39791 0.0000109300157374 ***
#> year^8       0.13081017  0.01999001    6.54378 0.0000000000599837 ***
#> year^9      -0.09275571  0.01578003   -5.87804 0.0000000041514597 ***
#> year^10      0.01609911  0.01307274    1.23150         0.21813505    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       6.860406 8.000711 319.3766 < 2.22e-16 ***
#> s(gdp_per_capita) 8.480225 8.919608 254.3667 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0335   Deviance explained = 4.07%
#> -REML = -49540  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.354566936e-2 weak           cohen1988
#> 2 SE       2.482603924e-3 <NA>           <NA>     
#> 3 Lower CI 2.867985508e-2 weak           cohen1988
#> 4 Upper CI 3.841148364e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.634063135e+1
#> 2 logLik         4.961835964e+4
#> 3 AIC           -9.918011725e+4
#> 4 BIC           -9.895844413e+4
#> 5 deviance       1.849066434e+4
#> 6 df.residual    1.860665937e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  3.354566936e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(118.894) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.323078644  0.009372166 -354.56890 < 2.22e-16 ***
#> year.L      -0.031024498  0.038161049   -0.81299 0.41622459    
#> year.Q      -0.119358152  0.034027726   -3.50767 0.00045204 ***
#> year.C      -0.034013954  0.034105490   -0.99732 0.31861110    
#> year^4       0.035079463  0.031372405    1.11816 0.26349737    
#> year^5       0.025803680  0.034067242    0.75743 0.44879002    
#> year^6      -0.012785594  0.031589366   -0.40474 0.68566598    
#> year^7       0.083565411  0.031587177    2.64555 0.00815586 ** 
#> year^8      -0.067300706  0.031657806   -2.12588 0.03351323 *  
#> year^9      -0.002276603  0.034527589   -0.06594 0.94742897    
#> year^10      0.010441924  0.030805977    0.33896 0.73464159    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq   p-value   
#> s(spei_12m)       1.012723 1.025344  0.24008 0.6415545   
#> s(gdp_per_capita) 2.940968 3.600515 13.47362 0.0067368 **
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00808   Deviance explained = 2.01%
#> -REML = -6942.8  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.080351296e-3 very weak (negligible) cohen1988
#> 2 SE       3.381575670e-3 <NA>                   <NA>     
#> 3 Lower CI 1.452584770e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.470811782e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.495369067e+1
#> 2 logLik         6.982124166e+3
#> 3 AIC           -1.393099661e+4
#> 4 BIC           -1.383391603e+4
#> 5 deviance       2.488864184e+3
#> 6 df.residual    2.523046309e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  8.080351296e-3
#> 9 npar           2.9        e+1
Code
mpepr_gam_2_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 176: Value of the coefficients in the mpepr_gam_2_by_misfs model.
A B C D
[Mean] -0.0923921638 -0.1865650987 -0.1648796021 -0.1265472223
(Intercept) -3.4313059020 -3.7681910020 -3.3409360850 -3.3230786436
year.L 0.4180798434 0.3755752514 -0.0991509332 -0.0310244980
year.Q -0.2528783963 -0.1591170523 -0.0744044884 -0.1193581517
year.C -0.0716008884 -0.1450416788 0.0987414897 -0.0340139544
year^4 -0.1008255885 -0.1650494296 -0.1249408540 0.0350794631
year^5 -0.1648355223 0.0846511545 0.0520675927 0.0258036801
year^6 0.0719493387 0.0421898792 -0.0168750641 -0.0127855939
year^7 -0.0627883945 0.0841834813 -0.0605311923 0.0835654106
year^8 0.0696058242 0.0797526568 0.1308101666 -0.0673007063
year^9 -0.0824508106 -0.0693408642 -0.0927557143 -0.0022766030
year^10 0.1338894080 0.1351143581 0.0160991117 0.0104419237
mean(s(spei_12m)) 0.0129178557 -0.0604114187 0.0433028759 0.0008239560
mean(s(gdp_per_capita)) 0.0752808484 -0.1512679831 -0.1843731526 -0.0269263754

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 198: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_2_by_misfs <-
  data |>
  gam_misfs(maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year)
data |>
  summarise_gam_misfs(maper_mpepr_gam_2_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.462) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.751421488  0.008482062 -324.38120 < 2.22e-16 ***
#> year.L       0.140613699  0.042887617    3.27866 0.00104303 ** 
#> year.Q      -0.258713202  0.031024430   -8.33902 < 2.22e-16 ***
#> year.C      -0.048547358  0.029070782   -1.66997 0.09492514 .  
#> year^4      -0.063029318  0.030659671   -2.05577 0.03980442 *  
#> year^5      -0.132804208  0.036726124   -3.61607 0.00029911 ***
#> year^6       0.059888337  0.032886412    1.82107 0.06859677 .  
#> year^7      -0.005492884  0.028995777   -0.18944 0.84975002    
#> year^8       0.074475763  0.028854490    2.58108 0.00984916 ** 
#> year^9      -0.100155590  0.029761011   -3.36533 0.00076452 ***
#> year^10      0.044649069  0.028217284    1.58233 0.11357415    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq      p-value    
#> s(spei_12m)       5.144458 6.380688  42.06683 0.0000021952 ***
#> s(gdp_per_capita) 8.054174 8.752707 120.17626   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.000893   Deviance explained = 3.91%
#> -REML = -13536  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name               value interpretation         rule     
#>   <chr>              <dbl> <chr>                  <chr>    
#> 1 R2        8.926017278e-4 very weak (negligible) cohen1988
#> 2 SE        6.697671402e-4 <NA>                   <NA>     
#> 3 Lower CI -4.201177451e-4 no effect              cohen1988
#> 4 Upper CI  2.205321201e-3 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.419863217e+1
#> 2 logLik         1.359742659e+4
#> 3 AIC           -2.714159000e+4
#> 4 BIC           -2.695805445e+4
#> 5 deviance       7.323591552e+3
#> 6 df.residual    7.246801368e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  8.926017278e-4
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.87) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.156638008  0.004963215 -636.00675         < 2.22e-16 ***
#> year.L       0.305884520  0.022772106   13.43242         < 2.22e-16 ***
#> year.Q      -0.200975296  0.017235847  -11.66031         < 2.22e-16 ***
#> year.C      -0.154736303  0.016618809   -9.31091         < 2.22e-16 ***
#> year^4      -0.144732230  0.017289239   -8.37123         < 2.22e-16 ***
#> year^5       0.098006122  0.017624583    5.56076 0.0000000268598336 ***
#> year^6       0.035838049  0.018720216    1.91440          0.0555686 .  
#> year^7       0.122238053  0.017535428    6.97092 0.0000000000031488 ***
#> year^8       0.070956701  0.016906644    4.19697 0.0000270508039197 ***
#> year^9      -0.047726861  0.017782619   -2.68391          0.0072768 ** 
#> year^10      0.105711643  0.018439891    5.73277 0.0000000098803968 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.789591 8.987551  386.7282 < 2.22e-16 ***
#> s(gdp_per_capita) 8.864479 8.993765 1217.6427 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0226   Deviance explained = 6.54%
#> -REML = -64648  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.264961359e-2 weak                   cohen1988
#> 2 SE       1.651098574e-3 <NA>                   <NA>     
#> 3 Lower CI 1.941351985e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.588570733e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.865407015e+1
#> 2 logLik         6.474207706e+4
#> 3 AIC           -1.294241915e+5
#> 4 BIC           -1.291760481e+5
#> 5 deviance       3.098039438e+4
#> 6 df.residual    2.901634593e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  2.264961359e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(50.006) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.648976913  0.003885322 -681.79091          < 2.22e-16 ***
#> year.L      -0.209289015  0.028253564   -7.40753 0.00000000000012868 ***
#> year.Q      -0.054004039  0.016027023   -3.36956          0.00075288 ***
#> year.C       0.080799048  0.014361015    5.62628 0.00000001841404644 ***
#> year^4      -0.088698420  0.014396551   -6.16109 0.00000000072246747 ***
#> year^5       0.071023507  0.014627822    4.85537 0.00000120161392883 ***
#> year^6       0.002932272  0.016408428    0.17871          0.85816913    
#> year^7      -0.008027666  0.013851600   -0.57955          0.56221951    
#> year^8       0.130665903  0.020154919    6.48308 0.00000000008987028 ***
#> year^9      -0.096630240  0.015918564   -6.07029 0.00000000127682405 ***
#> year^10      0.017387835  0.013141087    1.32317          0.18578027    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       6.788722 7.942588 230.5865 < 2.22e-16 ***
#> s(gdp_per_capita) 8.177982 8.809404 179.1136 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0335   Deviance explained = 3.95%
#> -REML = -37767  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.345831209e-2 weak           cohen1988
#> 2 SE       2.479593414e-3 <NA>           <NA>     
#> 3 Lower CI 2.859839830e-2 weak           cohen1988
#> 4 Upper CI 3.831822588e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.596670416e+1
#> 2 logLik         3.784267591e+4
#> 3 AIC           -7.562915906e+4
#> 4 BIC           -7.540908882e+4
#> 5 deviance       1.823334114e+4
#> 6 df.residual    1.860703330e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  3.345831209e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(63.388) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.695624915  0.009663394 -278.95218 < 2.22e-16 ***
#> year.L      -0.144663785  0.038661157   -3.74184 0.00018268 ***
#> year.Q      -0.109716249  0.035001638   -3.13460 0.00172087 ** 
#> year.C      -0.058524499  0.035097741   -1.66747 0.09542059 .  
#> year^4       0.033064438  0.032320074    1.02303 0.30629319    
#> year^5       0.040529387  0.035182040    1.15199 0.24932484    
#> year^6       0.002498689  0.032613229    0.07662 0.93892918    
#> year^7       0.101739705  0.032524857    3.12806 0.00175964 ** 
#> year^8      -0.049578296  0.032603892   -1.52063 0.12835395    
#> year^9      -0.002859773  0.035600155   -0.08033 0.93597451    
#> year^10      0.017620285  0.031846651    0.55329 0.58006806    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq   p-value   
#> s(spei_12m)       1.025010 1.049637  0.19522 0.7018100   
#> s(gdp_per_capita) 2.222026 2.728323 15.35648 0.0014765 **
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0244   Deviance explained = 3.22%
#> -REML = -5425.6  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.435717666e-2 weak                   cohen1988
#> 2 SE       5.774731859e-3 <NA>                   <NA>     
#> 3 Lower CI 1.303891020e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.567544313e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.424703656e+1
#> 2 logLik         5.463150490e+3
#> 3 AIC           -1.089474506e+4
#> 4 BIC           -1.080261548e+4
#> 5 deviance       2.479619569e+3
#> 6 df.residual    2.523752963e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.435717666e-2
#> 9 npar           2.9        e+1
Code
maper_mpepr_gam_2_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 177: Value of the coefficients in the maper_mpepr_gam_2_by_misfs model.
A B C D
[Mean] -0.1082130059 -0.1657743707 -0.1187755930 -0.1102038959
(Intercept) -2.7514214879 -3.1566380084 -2.6489769132 -2.6956249152
year.L 0.1406136994 0.3058845201 -0.2092890147 -0.1446637855
year.Q -0.2587132018 -0.2009752963 -0.0540040387 -0.1097162486
year.C -0.0485473583 -0.1547363029 0.0807990481 -0.0585244992
year^4 -0.0630293175 -0.1447322299 -0.0886984201 0.0330644379
year^5 -0.1328042078 0.0980061220 0.0710235073 0.0405293873
year^6 0.0598883373 0.0358380488 0.0029322725 0.0024986890
year^7 -0.0054928845 0.1222380534 -0.0080276665 0.1017397050
year^8 0.0744757633 0.0709567011 0.1306659029 -0.0495782957
year^9 -0.1001555901 -0.0477268614 -0.0966302403 -0.0028597734
year^10 0.0446490686 0.1057116433 0.0173878355 0.0176202846
mean(s(spei_12m)) 0.0293925407 -0.0365198205 0.0706258190 0.0008421603
mean(s(gdp_per_capita)) -0.0402414287 -0.1680671949 -0.1419229823 -0.0375530457

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_2_by_misfs,
    type = 2,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 199: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_2_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(spei_12m) + s(gdp_per_capita) + year (Unordered year)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr ~ s(spei_12m) + s(gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.243) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value             Pr(>|z|)    
#> (Intercept) -3.29345758  0.03922414 -83.96506           < 2.22e-16 ***
#> year2009     0.38113814  0.05342253   7.13441 0.000000000000972045 ***
#> year2011     0.35746173  0.04725481   7.56456 0.000000000000038919 ***
#> year2012     0.37238373  0.05074703   7.33804 0.000000000000216743 ***
#> year2013     0.50683437  0.04828324  10.49711           < 2.22e-16 ***
#> year2014     0.70521400  0.05037534  13.99919           < 2.22e-16 ***
#> year2015     0.60565270  0.05561895  10.88932           < 2.22e-16 ***
#> year2016     0.71582038  0.05496072  13.02422           < 2.22e-16 ***
#> year2017     0.61438359  0.05381219  11.41718           < 2.22e-16 ***
#> year2018     0.65857556  0.05009520  13.14648           < 2.22e-16 ***
#> year2019     0.69408771  0.05751035  12.06892           < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq  p-value    
#> s(spei_12m)       4.213269 5.321403  19.62633 0.002229 ** 
#> s(gdp_per_capita) 7.983053 8.718735 136.86642  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0043   Deviance explained = 4.84%
#> -REML = -13462  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.319632186e+1
#> 2 logLik         1.351835954e+4
#> 3 AIC           -2.698515574e+4
#> 4 BIC           -2.680747751e+4
#> 5 deviance       7.443829780e+3
#> 6 df.residual    7.247803678e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.304359701e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.174) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.40646962  0.01941116 -175.49028 < 2.22e-16 ***
#> year2009     0.24468411  0.02561504    9.55236 < 2.22e-16 ***
#> year2011     0.28923928  0.02516195   11.49511 < 2.22e-16 ***
#> year2012     0.21491095  0.02721915    7.89558 2.8897e-15 ***
#> year2013     0.44890949  0.02633677   17.04497 < 2.22e-16 ***
#> year2014     0.40767031  0.02749211   14.82863 < 2.22e-16 ***
#> year2015     0.41103172  0.02635930   15.59343 < 2.22e-16 ***
#> year2016     0.45424880  0.02694722   16.85698 < 2.22e-16 ***
#> year2017     0.42027043  0.02734804   15.36748 < 2.22e-16 ***
#> year2018     0.35013630  0.02744560   12.75746 < 2.22e-16 ***
#> year2019     0.28734467  0.02845582   10.09792 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       8.332668 8.882537 131.9754 < 2.22e-16 ***
#> s(gdp_per_capita) 8.666506 8.963381 511.9798 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00906   Deviance explained = 3.19%
#> -REML = -62821  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.799917357e+1
#> 2 logLik         6.290498951e+4
#> 3 AIC           -1.257502872e+5
#> 4 BIC           -1.255032644e+5
#> 5 deviance       3.063357529e+4
#> 6 df.residual    2.901700083e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -9.063547776e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(40.229) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value    Pr(>|z|)    
#> (Intercept) -2.64148906  0.02070078 -127.60334  < 2.22e-16 ***
#> year2009     0.08282921  0.02019444    4.10158 0.000041033 ***
#> year2011     0.08781896  0.02237944    3.92409 0.000087058 ***
#> year2012    -0.07873481  0.03107743   -2.53351   0.0112928 *  
#> year2013     0.02707531  0.02340528    1.15680   0.2473527    
#> year2014     0.06469658  0.02262619    2.85937   0.0042449 ** 
#> year2015    -0.04840145  0.03241211   -1.49331   0.1353551    
#> year2016     0.02474351  0.03559739    0.69509   0.4869967    
#> year2017     0.03917031  0.03020185    1.29695   0.1946481    
#> year2018     0.01373116  0.03120122    0.44008   0.6598763    
#> year2019     0.04371550  0.03036720    1.43956   0.1499911    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.162494 8.819018  60.96357 < 2.22e-16 ***
#> s(gdp_per_capita) 8.797123 8.987155 235.09336 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.042   Deviance explained = 3.41%
#> -REML = -35899  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.201543224e-2 weak           cohen1988
#> 2 SE       2.754043533e-3 <NA>           <NA>     
#> 3 Lower CI 3.661760610e-2 weak           cohen1988
#> 4 Upper CI 4.741325838e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.795961713e+1
#> 2 logLik         3.598537166e+4
#> 3 AIC           -7.191113097e+4
#> 4 BIC           -7.167766848e+4
#> 5 deviance       1.812816377e+4
#> 6 df.residual    1.860504038e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  4.201543224e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(37.383) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.248505937  0.039536102 -56.87222 < 2.22e-16 ***
#> year2009     0.047028126  0.047531960   0.98940 0.32246742    
#> year2011    -0.020590121  0.049576514  -0.41532 0.67790761    
#> year2012    -0.198631332  0.053589727  -3.70652 0.00021013 ***
#> year2013     0.004997577  0.051883154   0.09632 0.92326350    
#> year2014     0.054019537  0.052618879   1.02662 0.30459994    
#> year2015    -0.109909042  0.066994670  -1.64056 0.10088796    
#> year2016    -0.052458382  0.058078911  -0.90323 0.36640596    
#> year2017    -0.044906082  0.058305077  -0.77019 0.44118623    
#> year2018    -0.065970079  0.056020835  -1.17760 0.23895651    
#> year2019    -0.039197581  0.056050014  -0.69933 0.48434443    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)       2.513916 3.221126   2.40512 0.45777    
#> s(gdp_per_capita) 7.252433 8.226255 137.33956 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0877   Deviance explained = 10.8%
#> -REML = -4342.2  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.08772279128 weak           cohen1988
#> 2 SE       0.01024732575 <NA>           <NA>     
#> 3 Lower CI 0.06763840187 weak           cohen1988
#> 4 Upper CI 0.1078071807  weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.076634920e+1
#> 2 logLik         4.391636743e+3
#> 3 AIC           -8.736378724e+3
#> 4 BIC           -8.599466376e+3
#> 5 deviance       2.448497468e+3
#> 6 df.residual    2.517233651e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  8.772279128e-2
#> 9 npar           2.9        e+1
Code
mbepr_gam_3_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 178: Value of the coefficients in the mbepr_gam_3_by_misfs model.
A B C D
[Mean] 0.0905257172 -0.0093777689 -0.2609963821 -0.4083543833
(Intercept) -3.2934575847 -3.4064696150 -2.6414890643 -2.2485059371
year2009 0.3811381355 0.2446841146 0.0828292118 0.0470281261
year2011 0.3574617319 0.2892392812 0.0878189626 -0.0205901209
year2012 0.3723837309 0.2149109514 -0.0787348139 -0.1986313325
year2013 0.5068343694 0.4489094892 0.0270753076 0.0049975769
year2014 0.7052140019 0.4076703076 0.0646965828 0.0540195366
year2015 0.6056527010 0.4110317171 -0.0484014469 -0.1099090418
year2016 0.7158203779 0.4542487981 0.0247435126 -0.0524583824
year2017 0.6143835928 0.4202704315 0.0391703135 -0.0449060821
year2018 0.6585755591 0.3501362974 0.0137311566 -0.0659700791
year2019 0.6940877056 0.2873446726 0.0437154960 -0.0391975813
mean(s(spei_12m)) -0.0171356472 0.0117758792 -0.0076226432 0.0017440117
mean(s(gdp_per_capita)) 0.0512635891 -0.0555460728 -0.5683829455 -1.0204277669

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR"
  )
Figure 200: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(beipr ~ s(spei_12m) + s(gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(beipr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.645) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value     Pr(>|z|)    
#> (Intercept) -3.04798167  0.03402953 -89.56872   < 2.22e-16 ***
#> year2009     0.13518197  0.04750879   2.84541    0.0044354 ** 
#> year2011     0.18863165  0.04094500   4.60695 0.0000040861 ***
#> year2012     0.20610846  0.04459771   4.62150 0.0000038097 ***
#> year2013     0.35699013  0.04184809   8.53062   < 2.22e-16 ***
#> year2014     0.49687733  0.04435374  11.20260   < 2.22e-16 ***
#> year2015     0.56582338  0.04830311  11.71402   < 2.22e-16 ***
#> year2016     0.50102049  0.04808602  10.41925   < 2.22e-16 ***
#> year2017     0.55643782  0.04657743  11.94651   < 2.22e-16 ***
#> year2018     0.61166220  0.04318892  14.16248   < 2.22e-16 ***
#> year2019     0.61879741  0.04999682  12.37674   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                       edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       5.66093 6.914622  27.08158 0.00027339 ***
#> s(gdp_per_capita) 8.53392 8.934795 204.07291 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0241   Deviance explained = 5.81%
#> -REML = -13222  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.413974465e-2 weak                   cohen1988
#> 2 SE       3.402019249e-3 <NA>                   <NA>     
#> 3 Lower CI 1.747190945e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.080757986e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.519484923e+1
#> 2 logLik         1.328709678e+4
#> 3 AIC           -2.651901920e+4
#> 4 BIC           -2.632889805e+4
#> 5 deviance       7.384862076e+3
#> 6 df.residual    7.245805151e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  2.413974465e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.383) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.09805733  0.01682532 -184.13068 < 2.22e-16 ***
#> year2009     0.14943122  0.02212487    6.75399 1.4383e-11 ***
#> year2011     0.17031529  0.02184206    7.79758 6.3104e-15 ***
#> year2012     0.08288759  0.02373244    3.49259 0.00047837 ***
#> year2013     0.29217259  0.02281434   12.80653 < 2.22e-16 ***
#> year2014     0.25707288  0.02389318   10.75926 < 2.22e-16 ***
#> year2015     0.34990851  0.02268679   15.42345 < 2.22e-16 ***
#> year2016     0.32542246  0.02334751   13.93821 < 2.22e-16 ***
#> year2017     0.36254999  0.02351630   15.41697 < 2.22e-16 ***
#> year2018     0.33248201  0.02360686   14.08413 < 2.22e-16 ***
#> year2019     0.29930832  0.02447886   12.22722 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.010772 8.752246  66.94599 < 2.22e-16 ***
#> s(gdp_per_capita) 8.679349 8.966034 524.44912 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0314   Deviance explained =  3.1%
#> -REML = -56534  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.769012098e+1
#> 2 logLik         5.661758801e+4
#> 3 AIC           -1.131757395e+5
#> 4 BIC           -1.129297731e+5
#> 5 deviance       3.031701357e+4
#> 6 df.residual    2.901730988e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -3.144979397e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(75.981) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value        Pr(>|z|)    
#> (Intercept) -2.553035101  0.015127773 -168.76477      < 2.22e-16 ***
#> year2009     0.050393419  0.014695108    3.42926      0.00060522 ***
#> year2011     0.018967042  0.016443732    1.15345      0.24872527    
#> year2012    -0.078985998  0.022660015   -3.48570      0.00049085 ***
#> year2013     0.036571697  0.017127370    2.13528      0.03273831 *  
#> year2014     0.048041803  0.016639147    2.88728      0.00388594 ** 
#> year2015     0.040607104  0.023562139    1.72340      0.08481534 .  
#> year2016    -0.006481901  0.026076863   -0.24857      0.80369414    
#> year2017     0.094639927  0.022056026    4.29089 0.0000177960405 ***
#> year2018     0.134071490  0.022668244    5.91451 0.0000000033287 ***
#> year2019     0.117260363  0.022172855    5.28846 0.0000001233472 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.397573 8.903406  65.41918 < 2.22e-16 ***
#> s(gdp_per_capita) 8.899197 8.996804 637.63411 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0809   Deviance explained = 6.05%
#> -REML = -39714  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       8.089570581e-2 weak           cohen1988
#> 2 SE       3.666362476e-3 <NA>           <NA>     
#> 3 Lower CI 7.370976740e-2 weak           cohen1988
#> 4 Upper CI 8.808164422e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.829676986e+1
#> 2 logLik         3.980828045e+4
#> 3 AIC           -7.955676047e+4
#> 4 BIC           -7.932256141e+4
#> 5 deviance       1.836583071e+4
#> 6 df.residual    1.860470323e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  8.089570581e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(57.883) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value    Pr(>|z|)    
#> (Intercept) -2.06742282  0.03026461 -68.31155  < 2.22e-16 ***
#> year2009     0.11996293  0.03593504   3.33833  0.00084284 ***
#> year2011     0.08959779  0.03733718   2.39969  0.01640880 *  
#> year2012     0.08415744  0.03959051   2.12570  0.03352846 *  
#> year2013     0.13832694  0.03905920   3.54147  0.00039791 ***
#> year2014     0.16178969  0.03999674   4.04507 0.000052307 ***
#> year2015     0.12575730  0.04955894   2.53753  0.01116377 *  
#> year2016     0.12525397  0.04355841   2.87554  0.00403336 ** 
#> year2017     0.17699950  0.04349766   4.06917 0.000047180 ***
#> year2018     0.17936211  0.04172591   4.29858 0.000017190 ***
#> year2019     0.17393720  0.04184036   4.15716 0.000032222 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq  p-value    
#> s(spei_12m)       2.672467 3.419177   9.52419 0.031068 *  
#> s(gdp_per_capita) 8.158620 8.794660 242.51498  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.123   Deviance explained = 12.4%
#> -REML = -4409.8  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1232997714  weak           cohen1988
#> 2 SE       0.01167507694 <NA>           <NA>     
#> 3 Lower CI 0.1004170411  weak           cohen1988
#> 4 Upper CI 0.1461825018  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.183108776e+1
#> 2 logLik         4.467818979e+3
#> 3 AIC           -8.887360976e+3
#> 4 BIC           -8.746413152e+3
#> 5 deviance       2.480929226e+3
#> 6 df.residual    2.516168912e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.232997714e-1
#> 9 npar           2.9        e+1
Code
beipr_gam_3_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 179: Value of the coefficients in the beipr_gam_3_by_misfs model.
A B C D
[Mean] 0.0537122356 -0.0257865164 -0.2371139357 -0.2131531711
(Intercept) -3.0479816664 -3.0980573264 -2.5530351008 -2.0674228187
year2009 0.1351819734 0.1494312161 0.0503934191 0.1199629338
year2011 0.1886316495 0.1703152947 0.0189670417 0.0895977917
year2012 0.2061084562 0.0828875885 -0.0789859985 0.0841574435
year2013 0.3569901304 0.2921725898 0.0365716968 0.1383269374
year2014 0.4968773350 0.2570728777 0.0480418034 0.1617896934
year2015 0.5658233800 0.3499085053 0.0406071037 0.1257572978
year2016 0.5010204916 0.3254224613 -0.0064819013 0.1252539673
year2017 0.5564378243 0.3625499895 0.0946399265 0.1769994953
year2018 0.6116622015 0.3324820125 0.1340714900 0.1793621065
year2019 0.6187974134 0.2993083222 0.1172603633 0.1739372033
mean(s(spei_12m)) -0.0293562426 -0.0123000663 -0.0130620883 -0.0157785180
mean(s(gdp_per_capita)) 0.0702568698 -0.0178446565 -0.5178661314 -0.5941285946

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of BEIPR"
  )
Figure 201: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_beipr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.267) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value       Pr(>|z|)    
#> (Intercept) -2.29235563  0.03104452 -73.84091     < 2.22e-16 ***
#> year2009     0.23312765  0.04148229   5.61993 0.000000019103 ***
#> year2011     0.20767734  0.03786622   5.48450 0.000000041464 ***
#> year2012     0.21089874  0.04033501   5.22868 0.000000170728 ***
#> year2013     0.36018712  0.03871929   9.30252     < 2.22e-16 ***
#> year2014     0.49900523  0.04013031  12.43462     < 2.22e-16 ***
#> year2015     0.44305785  0.04418189  10.02804     < 2.22e-16 ***
#> year2016     0.48924911  0.04440188  11.01866     < 2.22e-16 ***
#> year2017     0.44611570  0.04304649  10.36358     < 2.22e-16 ***
#> year2018     0.47958171  0.04024774  11.91574     < 2.22e-16 ***
#> year2019     0.51397910  0.04592658  11.19132     < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)       3.020606 3.879663   6.40391  0.2102    
#> s(gdp_per_capita) 8.578943 8.946782 297.75208  <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0395   Deviance explained = 5.29%
#> -REML = -9223.4  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.951783790e-2 weak           cohen1988
#> 2 SE       4.284189687e-3 <NA>           <NA>     
#> 3 Lower CI 3.112098041e-2 weak           cohen1988
#> 4 Upper CI 4.791469539e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.259954856e+1
#> 2 logLik         9.284757045e+3
#> 3 AIC           -1.851986120e+4
#> 4 BIC           -1.834876605e+4
#> 5 deviance       7.108154908e+3
#> 6 df.residual    7.248400451e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  3.951783790e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.995) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.41919358  0.01581646 -152.95418 < 2.22e-16 ***
#> year2009     0.16600899  0.02069811    8.02049 1.0532e-15 ***
#> year2011     0.16639740  0.02043914    8.14112 3.9165e-16 ***
#> year2012     0.10201898  0.02218430    4.59870 4.2513e-06 ***
#> year2013     0.27854034  0.02121132   13.13169 < 2.22e-16 ***
#> year2014     0.26494308  0.02243277   11.81054 < 2.22e-16 ***
#> year2015     0.28300496  0.02145058   13.19335 < 2.22e-16 ***
#> year2016     0.27292453  0.02202014   12.39431 < 2.22e-16 ***
#> year2017     0.27743869  0.02209579   12.55618 < 2.22e-16 ***
#> year2018     0.24015736  0.02236224   10.73942 < 2.22e-16 ***
#> year2019     0.20989831  0.02324140    9.03123 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq      p-value    
#> s(spei_12m)       4.541934 5.656737  34.66547 0.0000039428 ***
#> s(gdp_per_capita) 8.721479 8.974247 557.97287   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00315   Deviance explained = 2.67%
#> -REML = -40967  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.426341372e+1
#> 2 logLik         4.104214771e+4
#> 3 AIC           -8.203194150e+4
#> 4 BIC           -8.181528527e+4
#> 5 deviance       2.915430259e+4
#> 6 df.residual    2.902073659e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared -3.151607063e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(34.171) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value     Pr(>|z|)    
#> (Intercept) -1.776999064  0.016794151 -105.81059   < 2.22e-16 ***
#> year2009     0.062037880  0.016339155    3.79688   0.00014653 ***
#> year2011     0.031590847  0.018196008    1.73614   0.08253879 .  
#> year2012    -0.116126253  0.025242904   -4.60035 0.0000042178 ***
#> year2013    -0.018446502  0.019027690   -0.96946   0.33231790    
#> year2014     0.004331179  0.018430087    0.23501   0.81420417    
#> year2015    -0.071415086  0.026328487   -2.71246   0.00667849 ** 
#> year2016    -0.064213296  0.029041455   -2.21109   0.02702955 *  
#> year2017     0.007313002  0.024577439    0.29755   0.76604710    
#> year2018     0.012561430  0.025333030    0.49585   0.61999894    
#> year2019     0.024013364  0.024714643    0.97162   0.33123715    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.562054 8.947813  97.68265 < 2.22e-16 ***
#> s(gdp_per_capita) 8.862406 8.994065 450.87895 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.075   Deviance explained = 6.43%
#> -REML = -27045  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       7.500488523e-2 weak           cohen1988
#> 2 SE       3.552974451e-3 <NA>           <NA>     
#> 3 Lower CI 6.804118327e-2 weak           cohen1988
#> 4 Upper CI 8.196858719e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.842446036e+1
#> 2 logLik         2.713838974e+4
#> 3 AIC           -5.421691429e+4
#> 4 BIC           -5.398246154e+4
#> 5 deviance       1.817912696e+4
#> 6 df.residual    1.860457554e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  7.500488523e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(26.853) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value Pr(>|z|)    
#> (Intercept) -1.305401262  0.034500623 -37.83704  < 2e-16 ***
#> year2009     0.081476602  0.041222338   1.97652 0.048096 *  
#> year2011     0.025581466  0.042858068   0.59689 0.550582    
#> year2012    -0.056286936  0.045254417  -1.24379 0.213577    
#> year2013     0.060142841  0.044776712   1.34317 0.179216    
#> year2014     0.092113337  0.045530858   2.02310 0.043063 *  
#> year2015    -0.015189444  0.056254145  -0.27001 0.787149    
#> year2016     0.003010431  0.050388684   0.05974 0.952359    
#> year2017     0.039937892  0.050205214   0.79549 0.426327    
#> year2018     0.031191788  0.047809102   0.65242 0.514128    
#> year2019     0.048117484  0.048194904   0.99839 0.318089    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq p-value    
#> s(spei_12m)       1.004184 1.008355   0.80454 0.37076    
#> s(gdp_per_capita) 8.074655 8.755006 230.86183 < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =   0.14   Deviance explained = 14.3%
#> -REML = -2896.1  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name             value interpretation rule     
#>   <chr>            <dbl> <chr>          <chr>    
#> 1 R2       0.1403277857  moderate       cohen1988
#> 2 SE       0.01221327742 <NA>           <NA>     
#> 3 Lower CI 0.1163902018  weak           cohen1988
#> 4 Upper CI 0.1642653696  moderate       cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.007883926e+1
#> 2 logLik         2.949316369e+3
#> 3 AIC           -5.855448281e+3
#> 4 BIC           -5.729368413e+3
#> 5 deviance       2.457919422e+3
#> 6 df.residual    2.517921161e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  1.403277857e-1
#> 9 npar           2.9        e+1
Code
mbepr_beipr_gam_3_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 180: Value of the coefficients in the mbepr_beipr_gam_3_by_misfs model.
A B C D
[Mean] 0.0739653619 -0.0121202132 -0.2504169315 -0.3015802868
(Intercept) -2.2923556303 -2.4191935836 -1.7769990643 -1.3054012621
year2009 0.2331276473 0.1660089899 0.0620378802 0.0814766022
year2011 0.2076773433 0.1663973962 0.0315908471 0.0255814665
year2012 0.2108987360 0.1020189776 -0.1161262530 -0.0562869365
year2013 0.3601871216 0.2785403398 -0.0184465017 0.0601428407
year2014 0.4990052338 0.2649430810 0.0043311789 0.0921133370
year2015 0.4430578502 0.2830049579 -0.0714150856 -0.0151894441
year2016 0.4892491119 0.2729245276 -0.0642132964 0.0030104307
year2017 0.4461156994 0.2774386859 0.0073130022 0.0399378920
year2018 0.4795817133 0.2401573563 0.0125614299 0.0311917877
year2019 0.5139791013 0.2098983069 0.0240133642 0.0481174839
mean(s(spei_12m)) -0.0062429072 0.0214584160 -0.0329240654 0.0013366481
mean(s(gdp_per_capita)) 0.0678508593 -0.0429723293 -0.5622691030 -0.8625058164

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
#> Warning: Removed 500 rows containing missing values or values outside the scale range
#> (`geom_line()`).
#> Warning in max(ids, na.rm = TRUE): no non-missing arguments to max;
#> returning -Inf
Figure 202: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper ~ s(spei_12m) + s(gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.147) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value         Pr(>|z|)    
#> (Intercept) -3.74039932  0.04165768 -89.78895       < 2.22e-16 ***
#> year2009     0.02398721  0.05892763   0.40706       0.68396228    
#> year2011     0.21211725  0.05060029   4.19202 0.00002764858817 ***
#> year2012     0.16025454  0.05445346   2.94296       0.00325087 ** 
#> year2013     0.27157993  0.05195628   5.22709 0.00000017220247 ***
#> year2014     0.31386443  0.05488656   5.71842 0.00000001075189 ***
#> year2015     0.20545993  0.06051133   3.39540       0.00068529 ***
#> year2016     0.30340505  0.06015133   5.04403 0.00000045582973 ***
#> year2017     0.37030847  0.05800356   6.38424 0.00000000017225 ***
#> year2018     0.22257044  0.05468459   4.07008 0.00004699785931 ***
#> year2019     0.10901415  0.06332311   1.72155       0.08515037 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       4.247119 5.365345 17.64906  0.0048491 ** 
#> s(gdp_per_capita) 6.755200 7.847116 54.04785 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0047   Deviance explained =  2.2%
#> -REML = -19071  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.200231852e+1
#> 2 logLik         1.912192573e+4
#> 3 AIC           -3.819342653e+4
#> 4 BIC           -3.801967110e+4
#> 5 deviance       7.707238177e+3
#> 6 df.residual    7.248997681e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -4.700829275e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.738) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -4.24347684  0.02041622 -207.84830 < 2.22e-16 ***
#> year2009     0.20182041  0.02717591    7.42644 1.1156e-13 ***
#> year2011     0.22249104  0.02667319    8.34137 < 2.22e-16 ***
#> year2012     0.07590031  0.02889485    2.62678  0.0086198 ** 
#> year2013     0.40503377  0.02804011   14.44480 < 2.22e-16 ***
#> year2014     0.30493334  0.02934774   10.39035 < 2.22e-16 ***
#> year2015     0.39223348  0.02798290   14.01690 < 2.22e-16 ***
#> year2016     0.40350972  0.02862591   14.09596 < 2.22e-16 ***
#> year2017     0.46440125  0.02890814   16.06472 < 2.22e-16 ***
#> year2018     0.23095878  0.02920618    7.90787 2.6182e-15 ***
#> year2019     0.17042732  0.03024568    5.63477 1.7530e-08 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       8.556612 8.946522 321.4451 < 2.22e-16 ***
#> s(gdp_per_capita) 8.825283 8.989705 864.3839 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0134   Deviance explained = 4.75%
#> -REML = -96468  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.338691524e-2 very weak (negligible) cohen1988
#> 2 SE       1.281384430e-3 <NA>                   <NA>     
#> 3 Lower CI 1.087544791e-2 very weak (negligible) cohen1988
#> 4 Upper CI 1.589838258e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.838189508e+1
#> 2 logLik         9.655564883e+4
#> 3 AIC           -1.930514252e+5
#> 4 BIC           -1.928036550e+5
#> 5 deviance       3.127616722e+4
#> 6 df.residual    2.901661810e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  1.338691524e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(53.919) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value       Pr(>|z|)    
#> (Intercept) -3.49351141  0.02422530 -144.20920     < 2.22e-16 ***
#> year2009     0.13337997  0.02438097    5.47066 0.000000044837 ***
#> year2011     0.25141284  0.02635422    9.53975     < 2.22e-16 ***
#> year2012    -0.01973082  0.03618490   -0.54528      0.5855625    
#> year2013     0.13856098  0.02706414    5.11973 0.000000305981 ***
#> year2014     0.11681197  0.02638188    4.42773 0.000009522788 ***
#> year2015     0.05948081  0.03744573    1.58845      0.1121838    
#> year2016     0.12967045  0.04119403    3.14780      0.0016451 ** 
#> year2017     0.07755906  0.03497282    2.21770      0.0265756 *  
#> year2018    -0.05247397  0.03638916   -1.44202      0.1492962    
#> year2019    -0.01465246  0.03536640   -0.41430      0.6786511    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       7.466508 8.445423 125.26600 < 2.22e-16 ***
#> s(gdp_per_capita) 8.170350 8.807415  94.89469 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0129   Deviance explained = 2.46%
#> -REML = -47149  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.286151339e-2 very weak (negligible) cohen1988
#> 2 SE       1.570116912e-3 <NA>                   <NA>     
#> 3 Lower CI 9.784140789e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.593888599e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.663685747e+1
#> 2 logLik         4.722342544e+4
#> 3 AIC           -9.438884293e+4
#> 4 BIC           -9.416166379e+4
#> 5 deviance       1.837359661e+4
#> 6 df.residual    1.860636314e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  1.286151339e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(90.209) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.485166840  0.040858133 -85.29922 < 2.22e-16 ***
#> year2009     0.042731334  0.052954427   0.80695 0.41969792    
#> year2011    -0.078113844  0.053722540  -1.45402 0.14593975    
#> year2012    -0.085456892  0.055976615  -1.52665 0.12684721    
#> year2013     0.032025743  0.053001905   0.60424 0.54568570    
#> year2014    -0.015765258  0.054350306  -0.29007 0.77176459    
#> year2015     0.001618113  0.068687645   0.02356 0.98120553    
#> year2016     0.016947152  0.059785064   0.28347 0.77681811    
#> year2017    -0.032749850  0.059882160  -0.54690 0.58444404    
#> year2018    -0.200881815  0.057531262  -3.49170 0.00047996 ***
#> year2019    -0.201261243  0.058124978  -3.46256 0.00053506 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       1.011885 1.023682  0.58730 0.45441626    
#> s(gdp_per_capita) 1.951469 2.408008 16.40875 0.00055587 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0234   Deviance explained = 3.33%
#> -REML = -6991.5  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.339901231e-2 weak                   cohen1988
#> 2 SE       5.665567499e-3 <NA>                   <NA>     
#> 3 Lower CI 1.229470406e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.450332056e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.396335330e+1
#> 2 logLik         7.025127363e+3
#> 3 AIC           -1.401939135e+4
#> 4 BIC           -1.392928368e+4
#> 5 deviance       2.476938563e+3
#> 6 df.residual    2.524036647e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.339901231e-2
#> 9 npar           2.9        e+1
Code
maper_gam_3_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 181: Value of the coefficients in the maper_gam_3_by_misfs model.
A B C D
[Mean] -0.0813271779 -0.1033925680 -0.1642732816 -0.1518874004
(Intercept) -3.7403993178 -4.2434768385 -3.4935114096 -3.4851668401
year2009 0.0239872119 0.2018204090 0.1333799698 0.0427313337
year2011 0.2121172544 0.2224910373 0.2514128359 -0.0781138444
year2012 0.1602545443 0.0759003111 -0.0197308203 -0.0854568924
year2013 0.2715799305 0.4050337725 0.1385609787 0.0320257434
year2014 0.3138644343 0.3049333447 0.1168119692 -0.0157652583
year2015 0.2054599275 0.3922334850 0.0594808142 0.0016181130
year2016 0.3034050520 0.4035097247 0.1296704486 0.0169471520
year2017 0.3703084741 0.4644012545 0.0775590584 -0.0327498495
year2018 0.2225704396 0.2309587818 -0.0524739697 -0.2008818153
year2019 0.1090141496 0.1704273232 -0.0146524559 -0.2012612435
mean(s(spei_12m)) 0.0239209369 -0.0457889341 -0.0420129688 0.0015068309
mean(s(gdp_per_capita)) -0.1139931878 -0.1349462968 -0.1902573186 -0.0458025210

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER"
  )
Figure 203: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mpepr ~ s(spei_12m) + s(gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mpepr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.574) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.70554856  0.03914823 -94.65431 < 2.22e-16 ***
#> year2009    -0.06318694  0.05564683  -1.13550 0.25616618    
#> year2011     0.27864614  0.04681438   5.95215 2.6465e-09 ***
#> year2012     0.19634912  0.05099548   3.85032 0.00011796 ***
#> year2013     0.38697026  0.04800738   8.06064 7.5896e-16 ***
#> year2014     0.24869584  0.05195238   4.78700 1.6930e-06 ***
#> year2015     0.37191656  0.05587458   6.65627 2.8086e-11 ***
#> year2016     0.38437547  0.05560340   6.91280 4.7516e-12 ***
#> year2017     0.48773249  0.05369215   9.08387 < 2.22e-16 ***
#> year2018     0.48199872  0.05025203   9.59163 < 2.22e-16 ***
#> year2019     0.24317155  0.05866329   4.14521 3.3951e-05 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       5.692085 6.957205  36.69025 < 2.22e-16 ***
#> s(gdp_per_capita) 8.181016 8.810878 117.03914 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0265   Deviance explained =  4.5%
#> -REML = -17924  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.487310079e+1
#> 2 logLik         1.798487580e+4
#> 3 AIC           -3.591421544e+4
#> 4 BIC           -3.572284756e+4
#> 5 deviance       7.684990495e+3
#> 6 df.residual    7.246126899e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared -2.648334231e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(27.853) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -4.03780407  0.01959620 -206.05034          < 2.22e-16 ***
#> year2009     0.16459906  0.02599572    6.33177 0.00000000024235678 ***
#> year2011     0.22439434  0.02553096    8.78911          < 2.22e-16 ***
#> year2012     0.07468282  0.02769766    2.69636           0.0070102 ** 
#> year2013     0.30333907  0.02695257   11.25455          < 2.22e-16 ***
#> year2014     0.20409976  0.02819042    7.24004 0.00000000000044856 ***
#> year2015     0.36450633  0.02677059   13.61592          < 2.22e-16 ***
#> year2016     0.43668211  0.02728135   16.00661          < 2.22e-16 ***
#> year2017     0.56484372  0.02738349   20.62717          < 2.22e-16 ***
#> year2018     0.35203426  0.02776343   12.67978          < 2.22e-16 ***
#> year2019     0.27656233  0.02878928    9.60643          < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       8.791883 8.987806 444.2199 < 2.22e-16 ***
#> s(gdp_per_capita) 8.839470 8.991264 932.8363 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00813   Deviance explained = 5.93%
#> -REML = -84054  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.132137454e-3 very weak (negligible) cohen1988
#> 2 SE       1.004034160e-3 <NA>                   <NA>     
#> 3 Lower CI 6.164266661e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.010000825e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.863135285e+1
#> 2 logLik         8.414638145e+4
#> 3 AIC           -1.682328048e+5
#> 4 BIC           -1.679846799e+5
#> 5 deviance       3.189865427e+4
#> 6 df.residual    2.901636865e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  8.132137454e-3
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(93.143) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -3.42693287  0.01923580 -178.15395          < 2.22e-16 ***
#> year2009     0.14213560  0.01937650    7.33546 0.00000000000022095 ***
#> year2011     0.30760210  0.02081891   14.77513          < 2.22e-16 ***
#> year2012     0.03445109  0.02826172    1.21900            0.222844    
#> year2013     0.10705705  0.02160162    4.95597 0.00000071969368777 ***
#> year2014     0.11955596  0.02112385    5.65976 0.00000001515823982 ***
#> year2015     0.04888934  0.02950527    1.65697            0.097526 .  
#> year2016     0.05441194  0.03247716    1.67539            0.093858 .  
#> year2017     0.06812168  0.02766481    2.46239            0.013801 *  
#> year2018     0.05337358  0.02853227    1.87064            0.061395 .  
#> year2019     0.01036631  0.02792473    0.37122            0.710471    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       6.860406 8.000711 319.3766 < 2.22e-16 ***
#> s(gdp_per_capita) 8.480225 8.919608 254.3667 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0335   Deviance explained = 4.07%
#> -REML = -49541  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.354566936e-2 weak           cohen1988
#> 2 SE       2.482603924e-3 <NA>           <NA>     
#> 3 Lower CI 2.867985508e-2 weak           cohen1988
#> 4 Upper CI 3.841148364e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.634063135e+1
#> 2 logLik         4.961835964e+4
#> 3 AIC           -9.918011725e+4
#> 4 BIC           -9.895844413e+4
#> 5 deviance       1.849066434e+4
#> 6 df.residual    1.860665937e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  3.354566936e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(118.894) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value Pr(>|z|)    
#> (Intercept) -3.35738023  0.03476473 -96.57432  < 2e-16 ***
#> year2009     0.06410668  0.04460669   1.43715 0.150674    
#> year2011    -0.04569232  0.04535726  -1.00739 0.313749    
#> year2012     0.06417669  0.04617055   1.38999 0.164531    
#> year2013     0.11348836  0.04451839   2.54925 0.010796 *  
#> year2014     0.05762120  0.04571465   1.26045 0.207506    
#> year2015     0.06958817  0.05718823   1.21683 0.223670    
#> year2016     0.09018290  0.05014183   1.79856 0.072089 .  
#> year2017     0.03312795  0.05032558   0.65827 0.510363    
#> year2018    -0.03287671  0.04779212  -0.68791 0.491509    
#> year2019    -0.03640544  0.04834060  -0.75310 0.451388    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq   p-value   
#> s(spei_12m)       1.012723 1.025344  0.24008 0.6415545   
#> s(gdp_per_capita) 2.940968 3.600515 13.47362 0.0067368 **
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00808   Deviance explained = 2.01%
#> -REML =  -6944  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.080351296e-3 very weak (negligible) cohen1988
#> 2 SE       3.381575670e-3 <NA>                   <NA>     
#> 3 Lower CI 1.452584770e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.470811782e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.495369067e+1
#> 2 logLik         6.982124166e+3
#> 3 AIC           -1.393099661e+4
#> 4 BIC           -1.383391603e+4
#> 5 deviance       2.488864184e+3
#> 6 df.residual    2.523046309e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  8.080351296e-3
#> 9 npar           2.9        e+1
Code
mpepr_gam_3_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 182: Value of the coefficients in the mpepr_gam_3_by_misfs model.
A B C D
[Mean] 0.0036175516 -0.1026612032 -0.1293310588 -0.1108615359
(Intercept) -3.7055485582 -4.0378040746 -3.4269328721 -3.3573802312
year2009 -0.0631869374 0.1645990559 0.1421356011 0.0641066751
year2011 0.2786461430 0.2243943407 0.3076020966 -0.0456923222
year2012 0.1963491177 0.0746828214 0.0344510907 0.0641766860
year2013 0.3869702640 0.3033390653 0.1070570500 0.1134883565
year2014 0.2486958434 0.2040997559 0.1195559615 0.0576211968
year2015 0.3719165623 0.3645063338 0.0488893438 0.0695881742
year2016 0.3843754730 0.4366821085 0.0544119352 0.0901828956
year2017 0.4877324905 0.5648437238 0.0681216823 0.0331279533
year2018 0.4819987154 0.3520342636 0.0533735825 -0.0328767146
year2019 0.2431715455 0.2765623291 0.0103663149 -0.0364054369
mean(s(spei_12m)) 0.0129178557 -0.0604114187 0.0433028759 0.0008239560
mean(s(gdp_per_capita)) 0.0752808484 -0.1512679831 -0.1843731526 -0.0269263754

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MPEPR"
  )
Figure 204: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_3_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_mpepr_gam_3_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.462) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value          Pr(>|z|)    
#> (Intercept) -2.90691532  0.03519452 -82.59567        < 2.22e-16 ***
#> year2009    -0.04913146  0.05006361  -0.98138        0.32640504    
#> year2011     0.20360443  0.04214866   4.83063 0.000001361041698 ***
#> year2012     0.13913958  0.04569320   3.04508        0.00232616 ** 
#> year2013     0.28798038  0.04325057   6.65842 0.000000000027679 ***
#> year2014     0.20429069  0.04650571   4.39281 0.000011189543781 ***
#> year2015     0.16958041  0.05079507   3.33852        0.00084226 ***
#> year2016     0.23961953  0.05048128   4.74670 0.000002067613268 ***
#> year2017     0.27787958  0.04881537   5.69246 0.000000012522133 ***
#> year2018     0.21448746  0.04599567   4.66321 0.000003113148839 ***
#> year2019     0.02298157  0.05346854   0.42981        0.66733038    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq      p-value    
#> s(spei_12m)       5.144458 6.380688  42.06683 0.0000021952 ***
#> s(gdp_per_capita) 8.054174 8.752707 120.17626   < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.000893   Deviance explained = 3.91%
#> -REML = -13537  Scale est. = 1         n = 7271
#> 
#> # A tibble: 4 × 4
#>   name               value interpretation         rule     
#>   <chr>              <dbl> <chr>                  <chr>    
#> 1 R2        8.926017278e-4 very weak (negligible) cohen1988
#> 2 SE        6.697671402e-4 <NA>                   <NA>     
#> 3 Lower CI -4.201177451e-4 no effect              cohen1988
#> 4 Upper CI  2.205321201e-3 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.419863217e+1
#> 2 logLik         1.359742659e+4
#> 3 AIC           -2.714159000e+4
#> 4 BIC           -2.695805445e+4
#> 5 deviance       7.323591552e+3
#> 6 df.residual    7.246801368e+3
#> 7 nobs           7.271000000e+3
#> 8 adj.r.squared  8.926017278e-4
#> 9 npar           2.9        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(19.87) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.41020431  0.01878661 -181.52309           < 2.22e-16 ***
#> year2009     0.18439888  0.02473011    7.45645 0.000000000000088883 ***
#> year2011     0.18767479  0.02447985    7.66650 0.000000000000017675 ***
#> year2012     0.09290789  0.02654026    3.50064           0.00046414 ***
#> year2013     0.29843151  0.02576282   11.58381           < 2.22e-16 ***
#> year2014     0.22545275  0.02701073    8.34678           < 2.22e-16 ***
#> year2015     0.34685692  0.02566817   13.51311           < 2.22e-16 ***
#> year2016     0.42046596  0.02616450   16.07009           < 2.22e-16 ***
#> year2017     0.54048578  0.02625763   20.58395           < 2.22e-16 ***
#> year2018     0.27900942  0.02675817   10.42707           < 2.22e-16 ***
#> year2019     0.21354545  0.02776013    7.69252 0.000000000000014426 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df    Chi.sq    p-value    
#> s(spei_12m)       8.789591 8.987551  386.7282 < 2.22e-16 ***
#> s(gdp_per_capita) 8.864479 8.993765 1217.6427 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0226   Deviance explained = 6.54%
#> -REML = -64649  Scale est. = 1         n = 29045
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.264961359e-2 weak                   cohen1988
#> 2 SE       1.651098574e-3 <NA>                   <NA>     
#> 3 Lower CI 1.941351985e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.588570733e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.865407015e+1
#> 2 logLik         6.474207706e+4
#> 3 AIC           -1.294241915e+5
#> 4 BIC           -1.291760481e+5
#> 5 deviance       3.098039438e+4
#> 6 df.residual    2.901634593e+4
#> 7 nobs           2.9045000  e+4
#> 8 adj.r.squared  2.264961359e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(50.006) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value        Pr(>|z|)    
#> (Intercept) -2.65641913  0.01893243 -140.31054      < 2.22e-16 ***
#> year2009     0.11239445  0.01901003    5.91237 0.0000000033721 ***
#> year2011     0.22419405  0.02057565   10.89609      < 2.22e-16 ***
#> year2012    -0.03574261  0.02822716   -1.26625      0.20542396    
#> year2013     0.05253343  0.02126647    2.47025      0.01350198 *  
#> year2014     0.03859854  0.02077256    1.85815      0.06314758 .  
#> year2015    -0.05229211  0.02942562   -1.77709      0.07555266 .  
#> year2016    -0.03228406  0.03243408   -0.99537      0.31955418    
#> year2017    -0.02170130  0.02746159   -0.79024      0.42938648    
#> year2018    -0.10931082  0.02850843   -3.83433      0.00012591 ***
#> year2019    -0.09452523  0.02773579   -3.40806      0.00065426 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq    p-value    
#> s(spei_12m)       6.788722 7.942588 230.5865 < 2.22e-16 ***
#> s(gdp_per_capita) 8.177982 8.809404 179.1136 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0335   Deviance explained = 3.95%
#> -REML = -37768  Scale est. = 1         n = 18633
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.345831209e-2 weak           cohen1988
#> 2 SE       2.479593414e-3 <NA>           <NA>     
#> 3 Lower CI 2.859839830e-2 weak           cohen1988
#> 4 Upper CI 3.831822588e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             2.596670416e+1
#> 2 logLik         3.784267591e+4
#> 3 AIC           -7.562915906e+4
#> 4 BIC           -7.540908882e+4
#> 5 deviance       1.823334114e+4
#> 6 df.residual    1.860703330e+4
#> 7 nobs           1.863300000e+4
#> 8 adj.r.squared  3.345831209e-2
#> 9 npar           2.9        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(63.388) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(spei_12m) + s(gdp_per_capita) + year
#> 
#> Parametric coefficients:
#>                  Estimate    Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.6624175512  0.0348536776 -76.38843 < 2.22e-16 ***
#> year2009     0.0429780409  0.0451113651   0.95271 0.34073711    
#> year2011    -0.0830209051  0.0458399077  -1.81111 0.07012454 .  
#> year2012    -0.0007241768  0.0469651072  -0.01542 0.98769753    
#> year2013     0.0512370729  0.0450887015   1.13636 0.25580522    
#> year2014    -0.0163484047  0.0463614791  -0.35263 0.72436655    
#> year2015    -0.0095160841  0.0583786292  -0.16301 0.87051348    
#> year2016     0.0081128758  0.0509589623   0.15920 0.87350807    
#> year2017    -0.0382202897  0.0510231690  -0.74908 0.45381071    
#> year2018    -0.1622384524  0.0487656431  -3.32690 0.00087818 ***
#> year2019    -0.1575406806  0.0492276200  -3.20025 0.00137309 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>                        edf   Ref.df   Chi.sq   p-value   
#> s(spei_12m)       1.025010 1.049637  0.19522 0.7018100   
#> s(gdp_per_capita) 2.222026 2.728323 15.35648 0.0014765 **
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0244   Deviance explained = 3.22%
#> -REML = -5426.8  Scale est. = 1         n = 2538
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.435717666e-2 weak                   cohen1988
#> 2 SE       5.774731859e-3 <NA>                   <NA>     
#> 3 Lower CI 1.303891020e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.567544313e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.424703656e+1
#> 2 logLik         5.463150490e+3
#> 3 AIC           -1.089474506e+4
#> 4 BIC           -1.080261548e+4
#> 5 deviance       2.479619569e+3
#> 6 df.residual    2.523752963e+3
#> 7 nobs           2.5380     e+3
#> 8 adj.r.squared  2.435717666e-2
#> 9 npar           2.9        e+1
Code
maper_mpepr_gam_3_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 183: Value of the coefficients in the maper_mpepr_gam_3_by_misfs model.
A B C D
[Mean] -0.0446249356 -0.0849054516 -0.1109044570 -0.1157964318
(Intercept) -2.9069153226 -3.4102043134 -2.6564191262 -2.6624175512
year2009 -0.0491314569 0.1843988842 0.1123944472 0.0429780409
year2011 0.2036044285 0.1876747875 0.2241940516 -0.0830209051
year2012 0.1391395772 0.0929078941 -0.0357426134 -0.0007241768
year2013 0.2879803824 0.2984315123 0.0525334338 0.0512370729
year2014 0.2042906906 0.2254527497 0.0385985436 -0.0163484047
year2015 0.1695804142 0.3468569173 -0.0522921123 -0.0095160841
year2016 0.2396195334 0.4204659607 -0.0322840576 0.0081128758
year2017 0.2778795816 0.5404857781 -0.0217013026 -0.0382202897
year2018 0.2144874637 0.2790094159 -0.1093108210 -0.1622384524
year2019 0.0229815671 0.2135454550 -0.0945252269 -0.1575406806
mean(s(spei_12m)) 0.0293925407 -0.0365198205 0.0706258190 0.0008421603
mean(s(gdp_per_capita)) -0.0402414287 -0.1680671949 -0.1419229823 -0.0375530457

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_3_by_misfs,
    type = 3,
    x_label = "Standardised Precipitation Evapotranspiration Index (12 months)",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 205: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_3_by_misfs model. All other variables are held constant at their mean values except SPEI. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By s(year) (Continuous year)

Code
mbepr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.488) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.764025565  0.008889087 -310.9459 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.887682 8.682594 164.6248 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0196   Deviance explained = 2.27%
#> -REML = -14555  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.887681869e+0
#> 2 logLik         1.457885247e+4
#> 3 AIC           -2.913653050e+4
#> 4 BIC           -2.906264320e+4
#> 5 deviance       8.116224104e+3
#> 6 df.residual    7.925112318e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.962561973e-2
#> 9 npar           1          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.503) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.067860265  0.004875082 -629.2941 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf  Ref.df   Chi.sq    p-value    
#> s(year) 7.979043 8.72876 232.1217 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00452   Deviance explained = 0.756%
#> -REML = -68054  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.979042735e+0
#> 2 logLik         6.807959833e+4
#> 3 AIC           -1.361377391e+5
#> 4 BIC           -1.360479915e+5
#> 5 deviance       3.347287221e+4
#> 6 df.residual    3.172502096e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -4.518969525e-3
#> 9 npar           1          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(38.438) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.601271212  0.004079439 -637.6542 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.128049 8.798209 356.0552 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0274   Deviance explained = 1.75%
#> -REML = -38672  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.742645089e-2 weak           cohen1988
#> 2 SE       2.259216614e-3 <NA>           <NA>     
#> 3 Lower CI 2.299846769e-2 weak           cohen1988
#> 4 Upper CI 3.185443408e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.128049307e+0
#> 2 logLik         3.869852716e+4
#> 3 AIC           -7.737554990e+4
#> 4 BIC           -7.729039715e+4
#> 5 deviance       1.976867118e+4
#> 6 df.residual    2.031487195e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.742645089e-2
#> 9 npar           1          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(34.962) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.26870964  0.01027894 -220.7143 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.830195 7.938482 131.2971 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0447   Deviance explained = 4.75%
#> -REML = -4662.6  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.468165164e-2 weak           cohen1988
#> 2 SE       7.663975966e-3 <NA>           <NA>     
#> 3 Lower CI 2.966053477e-2 weak           cohen1988
#> 4 Upper CI 5.970276851e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.830194824e+0
#> 2 logLik         4.681903728e+3
#> 3 AIC           -9.343930493e+3
#> 4 BIC           -9.285029059e+3
#> 5 deviance       2.679398229e+3
#> 6 df.residual    2.762169805e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  4.468165164e-2
#> 9 npar           1          e+1
Code
mbepr_gam_4_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 184: Value of the coefficients in the mbepr_gam_4_by_misfs model.
A B C D
[Mean] -0.2377084428 -0.2931434504 -0.2389874165 -0.2287300141
(Intercept) -2.7640255650 -3.0678602646 -2.6012712124 -2.2687096436
mean(s(year)) 0.0429934597 0.0151584178 0.0234885609 -0.0020656109

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 206: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(beipr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(beipr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.114) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error  z value   Pr(>|z|)    
#> (Intercept) -2.652246484  0.007815092 -339.375 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.840362 7.947109 208.1875 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.028   Deviance explained = 2.66%
#> -REML = -14294  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.840362260e+0
#> 2 logLik         1.431385290e+4
#> 3 AIC           -2.860796999e+4
#> 4 BIC           -2.853910272e+4
#> 5 deviance       8.071653579e+3
#> 6 df.residual    7.926159638e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.802353414e-2
#> 9 npar           1          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.649) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.847564146  0.004210194 -676.3499 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.108529 8.789822 259.2185 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0153   Deviance explained = 0.869%
#> -REML = -61296  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.108528612e+0
#> 2 logLik         6.132240410e+4
#> 3 AIC           -1.226233722e+5
#> 4 BIC           -1.225337147e+5
#> 5 deviance       3.310345549e+4
#> 6 df.residual    3.172489147e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -1.533028485e-2
#> 9 npar           1          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(72.181) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.502699587  0.002991543 -836.5916 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.538153 8.473267 465.9022 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0356   Deviance explained = 2.24%
#> -REML = -42829  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.563220368e-2 weak           cohen1988
#> 2 SE       2.553375305e-3 <NA>           <NA>     
#> 3 Lower CI 3.062768004e-2 weak           cohen1988
#> 4 Upper CI 4.063672731e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.538153256e+0
#> 2 logLik         4.285311826e+4
#> 3 AIC           -8.568632581e+4
#> 4 BIC           -8.560748386e+4
#> 5 deviance       2.003209684e+4
#> 6 df.residual    2.031546185e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  3.563220368e-2
#> 9 npar           1          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(52.175) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.926318771  0.007635733 -252.2769 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 4.985377 6.078625 72.70812 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0342   Deviance explained =  2.7%
#> -REML = -4700.7  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.424800961e-2 weak           cohen1988
#> 2 SE       6.783044810e-3 <NA>           <NA>     
#> 3 Lower CI 2.095348608e-2 weak           cohen1988
#> 4 Upper CI 4.754253314e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             5.985376796e+0
#> 2 logLik         4.715764580e+3
#> 3 AIC           -9.415371910e+3
#> 4 BIC           -9.367493110e+3
#> 5 deviance       2.719239612e+3
#> 6 df.residual    2.764014623e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  3.424800961e-2
#> 9 npar           1          e+1
Code
beipr_gam_4_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 185: Value of the coefficients in the beipr_gam_4_by_misfs model.
A B C D
[Mean] -0.2698576417 -0.2832120355 -0.2791948984 -0.2053964306
(Intercept) -2.6522464837 -2.8475641461 -2.5026995872 -1.9263187709
mean(s(year)) -0.0051477703 0.0017159768 -0.0321388219 -0.0141828373

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 207: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mbepr_beipr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mbepr_beipr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.183) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.92643518  0.00732242 -263.0872 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.487202 8.440969 87.60946 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00999   Deviance explained = 1.24%
#> -REML = -9877.9  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.487202293e+0
#> 2 logLik         9.900141715e+3
#> 3 AIC           -1.978032556e+4
#> 4 BIC           -1.971068344e+4
#> 5 deviance       7.755904132e+3
#> 6 df.residual    7.925512798e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -9.992387590e-3
#> 9 npar           1          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.446) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.201625036  0.004007156 -549.4234 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.090503 8.781786 158.3798 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00203   Deviance explained = 0.545%
#> -REML = -44239  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.090502994e+0
#> 2 logLik         4.426560120e+4
#> 3 AIC           -8.851017443e+4
#> 4 BIC           -8.842222342e+4
#> 5 deviance       3.182801932e+4
#> 6 df.residual    3.172490950e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.025155691e-3
#> 9 npar           1          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.282) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.77538891  0.00334683 -530.4687 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 7.448459 8.413178 720.6691 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0428   Deviance explained = 3.42%
#> -REML = -28936  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.276223341e-2 weak           cohen1988
#> 2 SE       2.776518861e-3 <NA>           <NA>     
#> 3 Lower CI 3.732035644e-2 weak           cohen1988
#> 4 Upper CI 4.820411038e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             8.448458557e+0
#> 2 logLik         2.895922531e+4
#> 3 AIC           -5.789834457e+4
#> 4 BIC           -5.781872905e+4
#> 5 deviance       1.982184104e+4
#> 6 df.residual    2.031555154e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  4.276223341e-2
#> 9 npar           1          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.301) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -1.259433674  0.008937905 -140.9093 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 5.628751 6.781089 149.8307 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0565   Deviance explained = 5.35%
#> -REML = -3049.2  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       5.650386597e-2 weak           cohen1988
#> 2 SE       8.511784358e-3 <NA>           <NA>     
#> 3 Lower CI 3.982107519e-2 weak           cohen1988
#> 4 Upper CI 7.318665676e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.628751260e+0
#> 2 logLik         3.065513233e+3
#> 3 AIC           -6.113464288e+3
#> 4 BIC           -6.061422264e+3
#> 5 deviance       2.689338651e+3
#> 6 df.residual    2.763371249e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.650386597e-2
#> 9 npar           1          e+1
Code
mbepr_beipr_gam_4_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 186: Value of the coefficients in the mbepr_beipr_gam_4_by_misfs model.
A B C D
[Mean] -0.1746701213 -0.2132274763 -0.1905945030 -0.1399896646
(Intercept) -1.9264351823 -2.2016250356 -1.7753889106 -1.2594336745
mean(s(year)) 0.0199704410 0.0077055858 -0.0145062355 -0.0156069969

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
#> Warning: Removed 500 rows containing missing values or values outside the scale range
#> (`geom_line()`).
#> Warning in max(ids, na.rm = TRUE): no non-missing arguments to max;
#> returning -Inf
Figure 208: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.728) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.528361904  0.009798933 -360.0761 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.71971 7.844291 67.31148 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0075   Deviance explained = 0.876%
#> -REML = -20724  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.719710001e+0
#> 2 logLik         2.074295858e+4
#> 3 AIC           -4.146622857e+4
#> 4 BIC           -4.139752613e+4
#> 5 deviance       8.431395374e+3
#> 6 df.residual    7.926280290e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -7.504047063e-3
#> 9 npar           1          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(22.999) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.947469608  0.005229374 -754.8647 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.024324 8.750592 174.1822 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00274   Deviance explained = 0.525%
#> -REML = -1.0447e+05  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.024323628e+0
#> 2 logLik         1.044963446e+5
#> 3 AIC           -2.089711881e+5
#> 4 BIC           -2.088812579e+5
#> 5 deviance       3.427273799e+4
#> 6 df.residual    3.172497568e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.739061946e-3
#> 9 npar           1          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.579) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.400230669  0.004764297 -713.6899 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.434371 8.911811 207.0213 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0114   Deviance explained = 1.09%
#> -REML = -50956  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.137519129e-2 very weak (negligible) cohen1988
#> 2 SE       1.478977177e-3 <NA>                   <NA>     
#> 3 Lower CI 8.476449290e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.427393329e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.434370799e+0
#> 2 logLik         5.098456076e+4
#> 3 AIC           -1.019472979e+5
#> 4 BIC           -1.018608812e+5
#> 5 deviance       2.004291470e+4
#> 6 df.residual    2.031456563e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  1.137519129e-2
#> 9 npar           1          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(84.051) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.51494952  0.01117707 -314.4786 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf Ref.df   Chi.sq    p-value    
#> s(year) 3.812015 4.7125 46.05516 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0231   Deviance explained = 1.89%
#> -REML = -7553.9  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.307311496e-2 weak                   cohen1988
#> 2 SE       5.631921366e-3 <NA>                   <NA>     
#> 3 Lower CI 1.203475192e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.411147800e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             4.812015363e+0
#> 2 logLik         7.565617215e+3
#> 3 AIC           -1.511780943e+4
#> 4 BIC           -1.507802711e+4
#> 5 deviance       2.709463766e+3
#> 6 df.residual    2.765187985e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.307311496e-2
#> 9 npar           1          e+1
Code
maper_gam_4_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 187: Value of the coefficients in the maper_gam_4_by_misfs model.
A B C D
[Mean] -0.3396719578 -0.3745725713 -0.2704610202 -0.3506199485
(Intercept) -3.5283619041 -3.9474696080 -3.4002306687 -3.5149495213
mean(s(year)) 0.0146269251 0.0224159884 0.0772911630 0.0009722263

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 209: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(mpepr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(mpepr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(31.016) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.415780792  0.008982098 -380.2876 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 5.876832 7.041259 144.7022 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.0331   Deviance explained = 1.82%
#> -REML = -19446  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.876831913e+0
#> 2 logLik         1.946273819e+4
#> 3 AIC           -3.890744891e+4
#> 4 BIC           -3.884454287e+4
#> 5 deviance       8.410916411e+3
#> 6 df.residual    7.927123168e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -3.306336093e-2
#> 9 npar           1          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.89) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.737458578  0.004989861 -749.0105 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.129835 8.799041 388.3712 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00817   Deviance explained = 1.12%
#> -REML = -90893  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.129834919e+0
#> 2 logLik         9.091881222e+4
#> 3 AIC           -1.818160264e+5
#> 4 BIC           -1.817256908e+5
#> 5 deviance       3.487152626e+4
#> 6 df.residual    3.172487017e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -8.168167937e-3
#> 9 npar           1          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(87.956) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.328906026  0.003775039 -881.8204 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf  Ref.df   Chi.sq    p-value    
#> s(year) 5.87848 7.04167 125.3592 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00837   Deviance explained = 0.658%
#> -REML = -53490  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.368181294e-3 very weak (negligible) cohen1988
#> 2 SE       1.272379336e-3 <NA>                   <NA>     
#> 3 Lower CI 5.874363621e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.086199897e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.878479732e+0
#> 2 logLik         5.350847177e+4
#> 3 AIC           -1.069996254e+5
#> 4 BIC           -1.069310493e+5
#> 5 deviance       2.018204211e+4
#> 6 df.residual    2.031712152e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  8.368181294e-3
#> 9 npar           1          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(117.221) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.316663217  0.008995402 -368.7065 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 2.804893 3.488528 18.45051 0.00068947 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.00962   Deviance explained = 0.78%
#> -REML = -7579.6  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       9.620417112e-3 very weak (negligible) cohen1988
#> 2 SE       3.686718987e-3 <NA>                   <NA>     
#> 3 Lower CI 2.394580677e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.684625355e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             3.804893450e+0
#> 2 logLik         7.589756430e+3
#> 3 AIC           -1.516853580e+4
#> 4 BIC           -1.513600748e+4
#> 5 deviance       2.724408547e+3
#> 6 df.residual    2.766195107e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  9.620417112e-3
#> 9 npar           1          e+1
Code
mpepr_gam_4_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 188: Value of the coefficients in the mpepr_gam_4_by_misfs model.
A B C D
[Mean] -0.3654426529 -0.3880494502 -0.3385856281 -0.3298481889
(Intercept) -3.4157807917 -3.7374585778 -3.3289060256 -3.3166632172
mean(s(year)) -0.0265161931 -0.0158928805 -0.0063278061 0.0020201475

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 210: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_4_by_misfs <-
  dplyr::mutate(data, year = as.integer(as.character(year))) |>
  gam_misfs(maper_mpepr ~ s(year))
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  summarise_gam_misfs(maper_mpepr_gam_4_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.501) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.738267001  0.008190896 -334.3062 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 5.355141 6.489999 77.43736 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00878   Deviance explained = 1.06%
#> -REML = -14650  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             6.355141079e+0
#> 2 logLik         1.466593064e+4
#> 3 AIC           -2.931488128e+4
#> 4 BIC           -2.925563031e+4
#> 5 deviance       8.013236128e+3
#> 6 df.residual    7.927644859e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -8.779179357e-3
#> 9 npar           1          e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.304) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -3.123772043  0.004812238 -649.1308 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 8.468487 8.921806 306.6465 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  -0.00354   Deviance explained = 0.906%
#> -REML = -69448  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             9.468486987e+0
#> 2 logLik         6.947625515e+4
#> 3 AIC           -1.389306667e+5
#> 4 BIC           -1.388393042e+5
#> 5 deviance       3.380077243e+4
#> 6 df.residual    3.172453151e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -3.543446137e-3
#> 9 npar           1          e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(47.018) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.63405992  0.00379428 -694.2186 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>             edf   Ref.df   Chi.sq    p-value    
#> s(year) 6.82548 7.933766 282.1114 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0205   Deviance explained = 1.46%
#> -REML = -40579  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.054835475e-2 weak                   cohen1988
#> 2 SE       1.969346524e-3 <NA>                   <NA>     
#> 3 Lower CI 1.668850649e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.440820301e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             7.825479515e+0
#> 2 logLik         4.060058114e+4
#> 3 AIC           -8.118129475e+4
#> 4 BIC           -8.110262372e+4
#> 5 deviance       1.989189348e+4
#> 6 df.residual    2.031617452e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.054835475e-2
#> 9 npar           1          e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(60.892) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ s(year)
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value   Pr(>|z|)    
#> (Intercept) -2.684274755  0.009366149 -286.5932 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Approximate significance of smooth terms:
#>              edf   Ref.df   Chi.sq    p-value    
#> s(year) 3.118664 3.873412 48.69109 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> R-sq.(adj) =  0.0245   Deviance explained = 1.94%
#> -REML = -5884.9  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.445679373e-2 weak                   cohen1988
#> 2 SE       5.790121474e-3 <NA>                   <NA>     
#> 3 Lower CI 1.310836418e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.580522329e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             4.118664335e+0
#> 2 logLik         5.895557018e+3
#> 3 AIC           -1.177936721e+4
#> 4 BIC           -1.174455783e+4
#> 5 deviance       2.711925400e+3
#> 6 df.residual    2.765881336e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.445679373e-2
#> 9 npar           1          e+1
Code
maper_mpepr_gam_4_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 189: Value of the coefficients in the maper_mpepr_gam_4_by_misfs model.
A B C D
[Mean] -0.2785507367 -0.3102520032 -0.2486774600 -0.2695130778
(Intercept) -2.7382670006 -3.1237720431 -2.6340599206 -2.6842747551
mean(s(year)) -0.0052489296 0.0023613345 0.0163650357 -0.0012062247

Source: Created by the authors.

Code
dplyr::mutate(data, year = as.integer(as.character(year))) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_4_by_misfs,
    type = 4,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 211: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_4_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Ordered)

In this model, the year variable is treated as a ordered categorical variable.

.L, .Q, and .C are, respectively, the coefficients for the ordered factor coded with linear, quadratic, and cubic contrasts.

Code
mbepr_gam_5_by_misfs <-
  data |>
  gam_misfs(mbepr ~ year)
data |>
  summarise_gam_misfs(mbepr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.537) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.76707348  0.00889582 -311.05322          < 2.22e-16 ***
#> year.L       0.28304655  0.03121408    9.06791          < 2.22e-16 ***
#> year.Q      -0.11246535  0.03138404   -3.58352          0.00033899 ***
#> year.C       0.04686843  0.03131901    1.49648          0.13452735    
#> year^4      -0.13966641  0.03090395   -4.51937 0.00000620235717360 ***
#> year^5       0.22113383  0.03081657    7.17581 0.00000000000071881 ***
#> year^6      -0.10484629  0.03047211   -3.44073          0.00058015 ***
#> year^7      -0.05267022  0.03059111   -1.72175          0.08511499 .  
#> year^8       0.05572956  0.03054007    1.82480          0.06803102 .  
#> year^9      -0.05530103  0.03045136   -1.81604          0.06936350 .  
#> year^10     -0.11170879  0.03077141   -3.63028          0.00028312 ***
#> year^11     -0.05494166  0.03049266   -1.80180          0.07157702 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0203   Deviance explained = 2.47%
#> -REML = -14555  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.458696428e+4
#> 3 AIC           -2.914792856e+4
#> 4 BIC           -2.905720269e+4
#> 5 deviance       8.119205011e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.027317837e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.507) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value           Pr(>|z|)    
#> (Intercept) -3.068257280  0.004876622 -629.17683         < 2.22e-16 ***
#> year.L       0.117916909  0.016977423    6.94551 0.0000000000037709 ***
#> year.Q      -0.174826699  0.017095705  -10.22635         < 2.22e-16 ***
#> year.C      -0.003230379  0.016997114   -0.19005          0.8492664    
#> year^4      -0.092998354  0.016928528   -5.49359 0.0000000393849543 ***
#> year^5       0.113903431  0.016871638    6.75118 0.0000000000146649 ***
#> year^6      -0.053888234  0.016821582   -3.20352          0.0013576 ** 
#> year^7      -0.005140243  0.016788872   -0.30617          0.7594755    
#> year^8       0.051135768  0.016775518    3.04824          0.0023019 ** 
#> year^9      -0.024217553  0.016789792   -1.44240          0.1491903    
#> year^10     -0.030014231  0.016842341   -1.78207          0.0747378 .  
#> year^11     -0.007893006  0.016932609   -0.46614          0.6411136    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00456   Deviance explained = 0.764%
#> -REML = -68042  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.808076769e+4
#> 3 AIC           -1.361355354e+5
#> 4 BIC           -1.360267885e+5
#> 5 deviance       3.347652301e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -4.559784873e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(38.489) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value          Pr(>|z|)    
#> (Intercept) -2.601124170  0.004077341 -637.94616        < 2.22e-16 ***
#> year.L      -0.221239238  0.014086278  -15.70601        < 2.22e-16 ***
#> year.Q       0.078115440  0.014179186    5.50916 0.000000036054493 ***
#> year.C       0.005758650  0.014116639    0.40793        0.68332249    
#> year^4      -0.058430541  0.014093349   -4.14597 0.000033838461198 ***
#> year^5       0.068477692  0.014150746    4.83916 0.000001303904250 ***
#> year^6       0.002665934  0.014041834    0.18986        0.84942154    
#> year^7      -0.007964157  0.014126746   -0.56376        0.57291445    
#> year^8       0.046695378  0.014092086    3.31359        0.00092107 ***
#> year^9      -0.002246625  0.014028708   -0.16014        0.87276696    
#> year^10     -0.094569778  0.014214460   -6.65307 0.000000000028704 ***
#> year^11     -0.023171492  0.014235985   -1.62767        0.10359478    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0285   Deviance explained = 1.87%
#> -REML = -38670  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.851689999e-2 weak           cohen1988
#> 2 SE       2.301108092e-3 <NA>           <NA>     
#> 3 Lower CI 2.400681100e-2 weak           cohen1988
#> 4 Upper CI 3.302698897e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.871102690e+4
#> 3 AIC           -7.739605379e+4
#> 4 BIC           -7.729309954e+4
#> 5 deviance       1.976947966e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.851689999e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(35.093) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value    Pr(>|z|)    
#> (Intercept) -2.268126583  0.010262308 -221.01525  < 2.22e-16 ***
#> year.L      -0.349342664  0.035482444   -9.84551  < 2.22e-16 ***
#> year.Q       0.118855625  0.035612748    3.33745  0.00084552 ***
#> year.C      -0.007878134  0.035733439   -0.22047  0.82550551    
#> year^4      -0.019372846  0.035323568   -0.54844  0.58339004    
#> year^5       0.087681548  0.035681486    2.45734  0.01399701 *  
#> year^6      -0.083700324  0.035219866   -2.37651  0.01747734 *  
#> year^7      -0.025897709  0.035565035   -0.72818  0.46650407    
#> year^8       0.100549311  0.035482342    2.83378  0.00460003 ** 
#> year^9       0.039742476  0.035343749    1.12446  0.26081979    
#> year^10     -0.141721586  0.036103188   -3.92546 0.000086564 ***
#> year^11     -0.005692148  0.035490482   -0.16039  0.87257765    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0455   Deviance explained = 5.16%
#> -REML = -4657.5  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.545270470e-2 weak           cohen1988
#> 2 SE       7.723581311e-3 <NA>           <NA>     
#> 3 Lower CI 3.031476350e-2 weak           cohen1988
#> 4 Upper CI 6.059064590e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.687741024e+3
#> 3 AIC           -9.349482048e+3
#> 4 BIC           -9.272436214e+3
#> 5 deviance       2.677966059e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  4.545270470e-2
#> 9 npar           1.2        e+1
Code
mbepr_gam_5_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 190: Value of the coefficients in the mbepr_gam_5_by_misfs model.
A B C D
[Mean] -0.2326579044 -0.2647924893 -0.2339194089 -0.2129085861
(Intercept) -2.7670734755 -3.0682572798 -2.6011241702 -2.2681265826
year.L 0.2830465530 0.1179169093 -0.2212392381 -0.3493426642
year.Q -0.1124653465 -0.1748266989 0.0781154405 0.1188556253
year.C 0.0468684280 -0.0032303794 0.0057586501 -0.0078781339
year^4 -0.1396664095 -0.0929983540 -0.0584305407 -0.0193728460
year^5 0.2211338304 0.1139034310 0.0684776920 0.0876815480
year^6 -0.1048462941 -0.0538882343 0.0026659342 -0.0837003236
year^7 -0.0526702159 -0.0051402433 -0.0079641573 -0.0258977089
year^8 0.0557295546 0.0511357681 0.0466953784 0.1005493105
year^9 -0.0553010304 -0.0242175533 -0.0022466255 0.0397424761
year^10 -0.1117087910 -0.0300142310 -0.0945697779 -0.1417215861
year^11 -0.0549416555 -0.0078930063 -0.0231714925 -0.0056921479

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 212: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_5_by_misfs <-
  data |>
  gam_misfs(beipr ~ year)
data |>
  summarise_gam_misfs(beipr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.127) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.653683063  0.007822268 -339.24725 < 2.22e-16 ***
#> year.L       0.363126602  0.027254975   13.32331 < 2.22e-16 ***
#> year.Q       0.006592482  0.027315449    0.24135  0.8092867    
#> year.C      -0.067126106  0.027355416   -2.45385  0.0141336 *  
#> year^4      -0.026716047  0.027091455   -0.98614  0.3240630    
#> year^5       0.072639093  0.027086258    2.68177  0.0073234 ** 
#> year^6      -0.067121673  0.026968738   -2.48887  0.0128150 *  
#> year^7      -0.106999017  0.026960591   -3.96872 0.00007226 ***
#> year^8       0.049467750  0.026962598    1.83468  0.0665531 .  
#> year^9       0.016125260  0.027014572    0.59691  0.5505677    
#> year^10     -0.019663087  0.027145861   -0.72435  0.4688513    
#> year^11      0.027474518  0.026908162    1.02105  0.3072318    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0299   Deviance explained = 2.71%
#> -REML = -14282  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.431571354e+4
#> 3 AIC           -2.860542709e+4
#> 4 BIC           -2.851470122e+4
#> 5 deviance       8.071957558e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.986476328e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.666) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.848403801  0.004212082 -676.24608 < 2.22e-16 ***
#> year.L       0.164472875  0.014594109   11.26981 < 2.22e-16 ***
#> year.Q      -0.042234319  0.014759944   -2.86141  0.0042176 ** 
#> year.C      -0.026048138  0.014657237   -1.77715  0.0755432 .  
#> year^4      -0.102261347  0.014581803   -7.01294 2.3336e-12 ***
#> year^5       0.113377180  0.014552940    7.79067 6.6654e-15 ***
#> year^6      -0.033556378  0.014535455   -2.30859  0.0209665 *  
#> year^7      -0.042350207  0.014462416   -2.92829  0.0034083 ** 
#> year^8       0.061968334  0.014463510    4.28446 1.8318e-05 ***
#> year^9      -0.008431711  0.014541208   -0.57985  0.5620162    
#> year^10      0.012862093  0.014613024    0.88018  0.3787618    
#> year^11      0.062101003  0.014736983    4.21396 2.5094e-05 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0159   Deviance explained = 0.926%
#> -REML = -61291  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.133176478e+4
#> 3 AIC           -1.226375296e+5
#> 4 BIC           -1.225287827e+5
#> 5 deviance       3.310622465e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -1.591864228e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(72.251) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value     Pr(>|z|)    
#> (Intercept) -2.502196791  0.002989478 -837.00117   < 2.22e-16 ***
#> year.L      -0.148795186  0.010256389  -14.50756   < 2.22e-16 ***
#> year.Q       0.140467010  0.010344901   13.57838   < 2.22e-16 ***
#> year.C      -0.015295539  0.010349307   -1.47793   0.13942683    
#> year^4      -0.045210704  0.010310435   -4.38495 0.0000116015 ***
#> year^5       0.031196138  0.010306005    3.02699   0.00247005 ** 
#> year^6      -0.048162565  0.010293102   -4.67911 0.0000028812 ***
#> year^7      -0.027614694  0.010329294   -2.67343   0.00750789 ** 
#> year^8       0.015704477  0.010361007    1.51573   0.12958795    
#> year^9       0.024284210  0.010396450    2.33582   0.01950075 *  
#> year^10     -0.026072357  0.010468922   -2.49045   0.01275804 *  
#> year^11      0.035524684  0.010496031    3.38458   0.00071287 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.036   Deviance explained = 2.34%
#> -REML = -42819  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.600156273e-2 weak           cohen1988
#> 2 SE       2.565592159e-3 <NA>           <NA>     
#> 3 Lower CI 3.097309450e-2 weak           cohen1988
#> 4 Upper CI 4.103003096e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.286366655e+4
#> 3 AIC           -8.570133310e+4
#> 4 BIC           -8.559837885e+4
#> 5 deviance       2.003054550e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  3.600156273e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(52.212) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -1.925855145  0.007633206 -252.29966           < 2.22e-16 ***
#> year.L      -0.197665440  0.026515721   -7.45465 0.000000000000090106 ***
#> year.Q       0.061061663  0.026628696    2.29308             0.021844 *  
#> year.C       0.056733481  0.026641358    2.12953             0.033211 *  
#> year^4      -0.048045087  0.026391217   -1.82050             0.068684 .  
#> year^5       0.037930444  0.026437739    1.43471             0.151370    
#> year^6      -0.065299046  0.026322574   -2.48072             0.013112 *  
#> year^7      -0.006545489  0.026302884   -0.24885             0.803476    
#> year^8       0.048114722  0.026298952    1.82953             0.067320 .  
#> year^9       0.010639848  0.026374879    0.40341             0.686648    
#> year^10     -0.022898650  0.026567896   -0.86189             0.388747    
#> year^11      0.009279899  0.026379237    0.35179             0.724997    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0327   Deviance explained = 2.94%
#> -REML = -4685.3  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       3.271189059e-2 weak                   cohen1988
#> 2 SE       6.639724773e-3 <NA>                   <NA>     
#> 3 Lower CI 1.969826917e-2 very weak (negligible) cohen1988
#> 4 Upper CI 4.572551202e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.719121470e+3
#> 3 AIC           -9.412242941e+3
#> 4 BIC           -9.335197107e+3
#> 5 deviance       2.714505806e+3
#> 6 df.residual    2.758000000e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  3.271189059e-2
#> 9 npar           1.2        e+1
Code
beipr_gam_5_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 191: Value of the coefficients in the beipr_gam_5_by_misfs model.
A B C D
[Mean] -0.2004902740 -0.2240420346 -0.2138476097 -0.1702124000
(Intercept) -2.6536830628 -2.8484038009 -2.5021967911 -1.9258551452
year.L 0.3631266025 0.1644728747 -0.1487951861 -0.1976654395
year.Q 0.0065924824 -0.0422343195 0.1404670099 0.0610616633
year.C -0.0671261060 -0.0260481377 -0.0152955393 0.0567334811
year^4 -0.0267160475 -0.1022613469 -0.0452107036 -0.0480450874
year^5 0.0726390926 0.1133771804 0.0311961381 0.0379304436
year^6 -0.0671216726 -0.0335563782 -0.0481625652 -0.0652990463
year^7 -0.1069990172 -0.0423502066 -0.0276146937 -0.0065454890
year^8 0.0494677502 0.0619683345 0.0157044771 0.0481147218
year^9 0.0161252596 -0.0084317112 0.0242842104 0.0106398483
year^10 -0.0196630871 0.0128620929 -0.0260723572 -0.0228986497
year^11 0.0274745179 0.0621010034 0.0355246842 0.0092798991

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 213: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_5_by_misfs <-
  data |>
  gam_misfs(mbepr_beipr ~ year)
data |>
  summarise_gam_misfs(mbepr_beipr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.202) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value        Pr(>|z|)    
#> (Intercept) -1.927800978  0.007327002 -263.10912      < 2.22e-16 ***
#> year.L       0.155049954  0.025596459    6.05748 0.0000000013827 ***
#> year.Q      -0.034396274  0.025664489   -1.34023       0.1801711    
#> year.C      -0.006036878  0.025713990   -0.23477       0.8143871    
#> year^4      -0.048352778  0.025401956   -1.90351       0.0569745 .  
#> year^5       0.144445424  0.025364494    5.69479 0.0000000123525 ***
#> year^6      -0.104062168  0.025157411   -4.13644 0.0000352732685 ***
#> year^7      -0.040925467  0.025253863   -1.62056       0.1051115    
#> year^8       0.048076497  0.025252105    1.90386       0.0569283 .  
#> year^9      -0.005973620  0.025227551   -0.23679       0.8128201    
#> year^10     -0.074641489  0.025428484   -2.93535       0.0033317 ** 
#> year^11     -0.024117334  0.025127362   -0.95980       0.3371540    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.011   Deviance explained = 1.35%
#> -REML = -9870.1  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.904385109e+3
#> 3 AIC           -1.978277022e+4
#> 4 BIC           -1.969204436e+4
#> 5 deviance       7.756093795e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.096589072e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.45) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.201794018  0.004008320 -549.30597 < 2.22e-16 ***
#> year.L       0.040093785  0.013924671    2.87933 0.00398515 ** 
#> year.Q      -0.083392401  0.014042704   -5.93849 2.8767e-09 ***
#> year.C      -0.011116822  0.013971517   -0.79568 0.42621951    
#> year^4      -0.072295526  0.013891383   -5.20434 1.9468e-07 ***
#> year^5       0.112196244  0.013857588    8.09638 5.6621e-16 ***
#> year^6      -0.053673556  0.013822192   -3.88314 0.00010311 ***
#> year^7      -0.026248013  0.013783413   -1.90432 0.05686867 .  
#> year^8       0.054572752  0.013781906    3.95974 7.5032e-05 ***
#> year^9      -0.002179925  0.013824727   -0.15768 0.87470654    
#> year^10     -0.010776896  0.013886529   -0.77607 0.43770862    
#> year^11      0.029660260  0.013948448    2.12642 0.03346829 *  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00237   Deviance explained = 0.56%
#> -REML = -44226  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.426792248e+4
#> 3 AIC           -8.850984496e+4
#> 4 BIC           -8.840109809e+4
#> 5 deviance       3.182959169e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.365279760e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.314) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                  Estimate    Std. Error    z value      Pr(>|z|)    
#> (Intercept) -1.7748564177  0.0033447160 -530.64488    < 2.22e-16 ***
#> year.L      -0.2594420089  0.0115120249  -22.53661    < 2.22e-16 ***
#> year.Q       0.1363862197  0.0115958679   11.76162    < 2.22e-16 ***
#> year.C       0.0012775965  0.0115719081    0.11041    0.91208819    
#> year^4      -0.0548553810  0.0115527519   -4.74825 0.00000205182 ***
#> year^5       0.0443979132  0.0115655057    3.83882    0.00012363 ***
#> year^6      -0.0231459262  0.0115222410   -2.00880    0.04455790 *  
#> year^7      -0.0104135840  0.0115768225   -0.89952    0.36837572    
#> year^8       0.0237630550  0.0115831063    2.05153    0.04021565 *  
#> year^9       0.0199901948  0.0115759610    1.72687    0.08419078 .  
#> year^10     -0.0617533698  0.0116776235   -5.28818 0.00000012354 ***
#> year^11      0.0007588868  0.0117154010    0.06478    0.94835167    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0434   Deviance explained = 3.53%
#> -REML = -28926  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.335752981e-2 weak           cohen1988
#> 2 SE       2.794039468e-3 <NA>           <NA>     
#> 3 Lower CI 3.788131308e-2 weak           cohen1988
#> 4 Upper CI 4.883374654e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.897004590e+4
#> 3 AIC           -5.791409181e+4
#> 4 BIC           -5.781113756e+4
#> 5 deviance       1.982049212e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  4.335752981e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.343) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -1.258354871  0.008929517 -140.92082 < 2.22e-16 ***
#> year.L      -0.345509238  0.030979054  -11.15300 < 2.22e-16 ***
#> year.Q       0.111788551  0.031051612    3.60009 0.00031811 ***
#> year.C       0.034028105  0.031098416    1.09421 0.27386419    
#> year^4      -0.025903944  0.030851767   -0.83963 0.40111816    
#> year^5       0.051005021  0.030976997    1.64655 0.09965160 .  
#> year^6      -0.079249591  0.030792775   -2.57364 0.01006342 *  
#> year^7      -0.005113017  0.030865679   -0.16565 0.86842941    
#> year^8       0.071840113  0.030835764    2.32977 0.01981853 *  
#> year^9       0.027230290  0.030836002    0.88307 0.37719947    
#> year^10     -0.073558247  0.031130417   -2.36291 0.01813227 *  
#> year^11     -0.006569161  0.030839502   -0.21301 0.83131819    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0573   Deviance explained = 5.65%
#> -REML = -3037.9  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       5.729349284e-2 weak           cohen1988
#> 2 SE       8.563879749e-3 <NA>           <NA>     
#> 3 Lower CI 4.050859696e-2 weak           cohen1988
#> 4 Upper CI 7.407838871e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.069860234e+3
#> 3 AIC           -6.113720467e+3
#> 4 BIC           -6.036674633e+3
#> 5 deviance       2.685543298e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.729349284e-2
#> 9 npar           1.2        e+1
Code
mbepr_beipr_gam_5_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 192: Value of the coefficients in the mbepr_beipr_gam_5_by_misfs model.
A B C D
[Mean] -0.1598945925 -0.1854128428 -0.1631577351 -0.1248638324
(Intercept) -1.9278009775 -2.2017940179 -1.7748564177 -1.2583548712
year.L 0.1550499540 0.0400937851 -0.2594420089 -0.3455092381
year.Q -0.0343962737 -0.0833924014 0.1363862197 0.1117885509
year.C -0.0060368785 -0.0111168219 0.0012775965 0.0340281054
year^4 -0.0483527776 -0.0722955259 -0.0548553810 -0.0259039438
year^5 0.1444454242 0.1121962443 0.0443979132 0.0510050208
year^6 -0.1040621684 -0.0536735555 -0.0231459262 -0.0792495910
year^7 -0.0409254671 -0.0262480125 -0.0104135840 -0.0051130169
year^8 0.0480764968 0.0545727522 0.0237630550 0.0718401134
year^9 -0.0059736197 -0.0021799254 0.0199901948 0.0272302901
year^10 -0.0746414893 -0.0107768958 -0.0617533698 -0.0735582472
year^11 -0.0241173338 0.0296602605 0.0007588868 -0.0065691607

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
#> Warning: Removed 12 rows containing missing values or values outside the scale range
#> (`geom_line()`).
#> Warning in max(ids, na.rm = TRUE): no non-missing arguments to max;
#> returning -Inf
Figure 214: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_5_by_misfs <-
  data |>
  gam_misfs(maper ~ year)
data |>
  summarise_gam_misfs(maper_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.761) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value      Pr(>|z|)    
#> (Intercept) -3.530069222  0.009802718 -360.11128    < 2.22e-16 ***
#> year.L       0.104598923  0.034445367    3.03666    0.00239214 ** 
#> year.Q      -0.194940662  0.034505042   -5.64963 0.00000001608 ***
#> year.C      -0.069618293  0.034281636   -2.03078    0.04227781 *  
#> year^4      -0.112521422  0.034064505   -3.30319    0.00095593 ***
#> year^5       0.075751354  0.034155401    2.21784    0.02656547 *  
#> year^6       0.049211214  0.033939964    1.44995    0.14707276    
#> year^7       0.002841143  0.033756387    0.08417    0.93292437    
#> year^8       0.134923449  0.033567360    4.01948 0.00005832586 ***
#> year^9       0.004377093  0.033514215    0.13060    0.89608852    
#> year^10     -0.033243415  0.033703404   -0.98635    0.32396049    
#> year^11     -0.019870002  0.033581458   -0.59170    0.55405443    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0079   Deviance explained = 0.957%
#> -REML = -20716  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.074635089e+4
#> 3 AIC           -4.146670177e+4
#> 4 BIC           -4.137597591e+4
#> 5 deviance       8.433850322e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -7.903895660e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.009) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.947715665  0.005230480 -754.75214       < 2.22e-16 ***
#> year.L       0.087036958  0.018122175    4.80279 0.00000156471910 ***
#> year.Q      -0.113028621  0.018263601   -6.18874 0.00000000060648 ***
#> year.C      -0.105741910  0.018137515   -5.83001 0.00000000554237 ***
#> year^4      -0.107411419  0.018126852   -5.92554 0.00000000311270 ***
#> year^5       0.079974056  0.018101738    4.41803 0.00000996036822 ***
#> year^6       0.018644792  0.018088259    1.03077        0.3026498    
#> year^7       0.047323466  0.018029506    2.62478        0.0086705 ** 
#> year^8       0.092256007  0.018013711    5.12143 0.00000030322303 ***
#> year^9      -0.005596113  0.018048568   -0.31006        0.7565164    
#> year^10     -0.003568097  0.018101221   -0.19712        0.8437343    
#> year^11      0.009635605  0.018272946    0.52732        0.5979746    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00248   Deviance explained = 0.544%
#> -REML = -1.0446e+05  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.044996352e+5
#> 3 AIC           -2.089732704e+5
#> 4 BIC           -2.088645236e+5
#> 5 deviance       3.427644493e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.481012795e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.613) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.400622395  0.004764848 -713.68955           < 2.22e-16 ***
#> year.L      -0.156051988  0.016747421   -9.31797           < 2.22e-16 ***
#> year.Q      -0.128726095  0.016714329   -7.70154 0.000000000000013443 ***
#> year.C      -0.005769232  0.016587436   -0.34781            0.7279849    
#> year^4      -0.024311829  0.016575313   -1.46675            0.1424443    
#> year^5       0.072274727  0.016663513    4.33730 0.000014424083339625 ***
#> year^6       0.049416716  0.016514786    2.99227            0.0027691 ** 
#> year^7       0.010033851  0.016506714    0.60786            0.5432771    
#> year^8       0.074491098  0.016371442    4.55006 0.000005362977646052 ***
#> year^9      -0.014569827  0.016226118   -0.89792            0.3692259    
#> year^10     -0.086108370  0.016350984   -5.26625 0.000000139238658588 ***
#> year^11      0.035871456  0.016297906    2.20099            0.0277370 *  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0109   Deviance explained = 1.15%
#> -REML = -50950  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.094496673e-2 very weak (negligible) cohen1988
#> 2 SE       1.451370507e-3 <NA>                   <NA>     
#> 3 Lower CI 8.100332809e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.378960065e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.098980161e+4
#> 3 AIC           -1.019536032e+5
#> 4 BIC           -1.018506490e+5
#> 5 deviance       2.004505690e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  1.094496673e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(84.23) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value       Pr(>|z|)    
#> (Intercept) -3.515374052  0.011174422 -314.59113     < 2.22e-16 ***
#> year.L      -0.230141752  0.039373090   -5.84515 0.000000005061 ***
#> year.Q      -0.094313845  0.039229772   -2.40414       0.016211 *  
#> year.C      -0.114018442  0.039109754   -2.91535       0.003553 ** 
#> year^4      -0.003614870  0.038856951   -0.09303       0.925880    
#> year^5       0.094367111  0.039007013    2.41923       0.015553 *  
#> year^6      -0.009984777  0.038729265   -0.25781       0.796554    
#> year^7       0.057408694  0.038592128    1.48758       0.136863    
#> year^8       0.057557812  0.038355782    1.50063       0.133451    
#> year^9      -0.029429933  0.038200427   -0.77041       0.441058    
#> year^10     -0.036098574  0.038367993   -0.94085       0.346781    
#> year^11      0.039762754  0.037953787    1.04766       0.294794    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0202   Deviance explained = 2.23%
#> -REML =  -7541  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.021475971e-2 weak                   cohen1988
#> 2 SE       5.286966888e-3 <NA>                   <NA>     
#> 3 Lower CI 9.852495026e-3 very weak (negligible) cohen1988
#> 4 Upper CI 3.057702440e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.570286498e+3
#> 3 AIC           -1.511457300e+4
#> 4 BIC           -1.503752716e+4
#> 5 deviance       2.705752165e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.021475971e-2
#> 9 npar           1.2        e+1
Code
maper_gam_5_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 193: Value of the coefficients in the maper_gam_5_by_misfs model.
A B C D
[Mean] -0.2990466532 -0.3290159117 -0.2978393239 -0.3153233228
(Intercept) -3.5300692218 -3.9477156646 -3.4006223949 -3.5153740522
year.L 0.1045989226 0.0870369581 -0.1560519880 -0.2301417517
year.Q -0.1949406618 -0.1130286207 -0.1287260955 -0.0943138451
year.C -0.0696182930 -0.1057419100 -0.0057692315 -0.1140184421
year^4 -0.1125214220 -0.1074114192 -0.0243118286 -0.0036148700
year^5 0.0757513539 0.0799740560 0.0722747273 0.0943671110
year^6 0.0492112142 0.0186447919 0.0494167162 -0.0099847771
year^7 0.0028411433 0.0473234656 0.0100338509 0.0574086938
year^8 0.1349234490 0.0922560068 0.0744910981 0.0575578122
year^9 0.0043770931 -0.0055961128 -0.0145698267 -0.0294299328
year^10 -0.0332434147 -0.0035680971 -0.0861083702 -0.0360985736
year^11 -0.0198700017 0.0096356051 0.0358714562 0.0397627537

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 215: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_5_by_misfs <-
  data |>
  gam_misfs(mpepr ~ year)
data |>
  summarise_gam_misfs(mpepr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(31.103) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value      Pr(>|z|)    
#> (Intercept) -3.418001960  0.008985228 -380.40237    < 2.22e-16 ***
#> year.L       0.303094333  0.031609890    9.58859    < 2.22e-16 ***
#> year.Q      -0.158190676  0.031750384   -4.98232 0.00000062825 ***
#> year.C      -0.097470279  0.031462320   -3.09800    0.00194831 ** 
#> year^4      -0.138041366  0.031282628   -4.41272 0.00001020817 ***
#> year^5      -0.009086991  0.031237449   -0.29090    0.77112738    
#> year^6       0.049991213  0.031092736    1.60781    0.10787678    
#> year^7      -0.038833115  0.030857266   -1.25848    0.20821983    
#> year^8       0.059640021  0.030709881    1.94205    0.05213146 .  
#> year^9      -0.024743805  0.030708151   -0.80577    0.42037363    
#> year^10      0.016476066  0.030781723    0.53525    0.59247365    
#> year^11      0.119592933  0.030868570    3.87426    0.00010695 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0362   Deviance explained = 2.05%
#> -REML = -19440  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.947212870e+4
#> 3 AIC           -3.891825739e+4
#> 4 BIC           -3.882753153e+4
#> 5 deviance       8.411778743e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -3.620918501e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.906) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value    Pr(>|z|)    
#> (Intercept) -3.738960964  0.004992705 -748.88475  < 2.22e-16 ***
#> year.L       0.221077589  0.017235399   12.82695  < 2.22e-16 ***
#> year.Q       0.012081960  0.017484799    0.69100  0.48956685    
#> year.C      -0.082749263  0.017281986   -4.78818 0.000001683 ***
#> year^4      -0.215515173  0.017280621  -12.47149  < 2.22e-16 ***
#> year^5       0.039394268  0.017260073    2.28239  0.02246616 *  
#> year^6       0.069864307  0.017249593    4.05020 0.000051174 ***
#> year^7       0.059107063  0.017159763    3.44452  0.00057208 ***
#> year^8       0.075172297  0.017141556    4.38538 0.000011578 ***
#> year^9       0.007909703  0.017212102    0.45954  0.64584421    
#> year^10      0.017543664  0.017317823    1.01304  0.31104060    
#> year^11      0.008739832  0.017618222    0.49607  0.61984660    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00743   Deviance explained = 1.15%
#> -REML = -90886  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.092481949e+4
#> 3 AIC           -1.818236390e+5
#> 4 BIC           -1.817148921e+5
#> 5 deviance       3.487532075e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -7.427616944e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(87.973) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value      Pr(>|z|)    
#> (Intercept) -3.329260365  0.003776245 -881.63259    < 2.22e-16 ***
#> year.L      -0.066944070  0.013287304   -5.03820 0.00000046994 ***
#> year.Q      -0.119293498  0.013280073   -8.98289    < 2.22e-16 ***
#> year.C       0.021973098  0.013169676    1.66846     0.0952241 .  
#> year^4      -0.038821997  0.013191626   -2.94293     0.0032512 ** 
#> year^5      -0.020191074  0.013118969   -1.53907     0.1237860    
#> year^6       0.036234449  0.013094189    2.76722     0.0056537 ** 
#> year^7      -0.002668151  0.013035156   -0.20469     0.8378152    
#> year^8      -0.016756343  0.012982576   -1.29068     0.1968149    
#> year^9      -0.033482543  0.012924629   -2.59060     0.0095809 ** 
#> year^10      0.004664769  0.012853677    0.36291     0.7166697    
#> year^11      0.006941334  0.012948368    0.53608     0.5919047    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00809   Deviance explained = 0.688%
#> -REML = -53469  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.093105311e-3 very weak (negligible) cohen1988
#> 2 SE       1.251639090e-3 <NA>                   <NA>     
#> 3 Lower CI 5.639937773e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.054627285e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.351150485e+4
#> 3 AIC           -1.069970097e+5
#> 4 BIC           -1.068940554e+5
#> 5 deviance       2.017974368e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  8.093105311e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(117.623) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.317347903  0.008989679 -369.01738 < 2.22e-16 ***
#> year.L      -0.100166486  0.031690452   -3.16078  0.0015735 ** 
#> year.Q      -0.093514337  0.031543235   -2.96464  0.0030304 ** 
#> year.C      -0.035982148  0.031531742   -1.14114  0.2538115    
#> year^4       0.006963582  0.031279783    0.22262  0.8238294    
#> year^5       0.058011246  0.031279652    1.85460  0.0636534 .  
#> year^6      -0.035862589  0.031206635   -1.14920  0.2504745    
#> year^7       0.048180826  0.030966098    1.55592  0.1197267    
#> year^8       0.036398244  0.030863216    1.17934  0.2382626    
#> year^9      -0.083403748  0.030898803   -2.69926  0.0069495 ** 
#> year^10      0.018230570  0.030806937    0.59177  0.5540057    
#> year^11      0.002568151  0.030463825    0.08430  0.9328166    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00546   Deviance explained = 1.33%
#> -REML = -7565.5  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name               value interpretation         rule     
#>   <chr>              <dbl> <chr>                  <chr>    
#> 1 R2        5.458795517e-3 very weak (negligible) cohen1988
#> 2 SE        2.788769371e-3 <NA>                   <NA>     
#> 3 Lower CI -7.092011279e-6 no effect              cohen1988
#> 4 Upper CI  1.092468305e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.597365316e+3
#> 3 AIC           -1.516873063e+4
#> 4 BIC           -1.509168480e+4
#> 5 deviance       2.718494668e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.458795517e-3
#> 9 npar           1.2        e+1
Code
mpepr_gam_5_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 194: Value of the coefficients in the mpepr_gam_5_by_misfs model.
A B C D
[Mean] -0.2779644688 -0.2938612265 -0.2964670326 -0.2913270493
(Intercept) -3.4180019602 -3.7389609638 -3.3292603651 -3.3173479030
year.L 0.3030943327 0.2210775893 -0.0669440696 -0.1001664860
year.Q -0.1581906756 0.0120819597 -0.1192934981 -0.0935143371
year.C -0.0974702788 -0.0827492634 0.0219730983 -0.0359821476
year^4 -0.1380413663 -0.2155151734 -0.0388219970 0.0069635820
year^5 -0.0090869910 0.0393942678 -0.0201910740 0.0580112458
year^6 0.0499912135 0.0698643068 0.0362344492 -0.0358625885
year^7 -0.0388331147 0.0591070634 -0.0026681514 0.0481808261
year^8 0.0596400206 0.0751722973 -0.0167563433 0.0363982444
year^9 -0.0247438051 0.0079097026 -0.0334825426 -0.0834037479
year^10 0.0164760660 0.0175436644 0.0046647693 0.0182305701
year^11 0.1195929332 0.0087398317 0.0069413337 0.0025681507

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 216: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_5_by_misfs <-
  data |>
  gam_misfs(maper_mpepr ~ year)
data |>
  summarise_gam_misfs(maper_mpepr_gam_5_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.539) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value             Pr(>|z|)    
#> (Intercept) -2.739534862  0.008193872 -334.33946           < 2.22e-16 ***
#> year.L       0.082363380  0.028987838    2.84131            0.0044929 ** 
#> year.Q      -0.220214939  0.028964569   -7.60291 0.000000000000028955 ***
#> year.C      -0.071155219  0.028714511   -2.47802            0.0132113 *  
#> year^4      -0.067622213  0.028554304   -2.36820            0.0178750 *  
#> year^5      -0.004810695  0.028628284   -0.16804            0.8665519    
#> year^6       0.061860888  0.028446118    2.17467            0.0296549 *  
#> year^7      -0.005878489  0.028196928   -0.20848            0.8348544    
#> year^8       0.094310981  0.027973611    3.37143            0.0007478 ***
#> year^9      -0.025048934  0.027892481   -0.89805            0.3691571    
#> year^10     -0.003939729  0.027970941   -0.14085            0.8879878    
#> year^11      0.038761967  0.027867424    1.39094            0.1642431    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0105   Deviance explained = 1.21%
#> -REML = -14639  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.467225123e+4
#> 3 AIC           -2.931850246e+4
#> 4 BIC           -2.922777659e+4
#> 5 deviance       8.012581771e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.046017779e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.318) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.124703269  0.004814081 -649.07572       < 2.22e-16 ***
#> year.L       0.100863495  0.016648945    6.05825 0.00000000137609 ***
#> year.Q      -0.028135499  0.016892394   -1.66557         0.095799 .  
#> year.C      -0.105013255  0.016687318   -6.29300 0.00000000031139 ***
#> year^4      -0.203844570  0.016660694  -12.23506       < 2.22e-16 ***
#> year^5       0.065707778  0.016659323    3.94420 0.00008006532378 ***
#> year^6       0.055786070  0.016640398    3.35245         0.000801 ***
#> year^7       0.079608090  0.016524969    4.81744 0.00000145409931 ***
#> year^8       0.099892126  0.016494522    6.05608 0.00000000139480 ***
#> year^9       0.003558448  0.016575211    0.21468         0.830013    
#> year^10      0.022954355  0.016691884    1.37518         0.169075    
#> year^11     -0.004565760  0.016959601   -0.26921         0.787765    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00293   Deviance explained = 0.958%
#> -REML = -69446  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.948485640e+4
#> 3 AIC           -1.389437128e+5
#> 4 BIC           -1.388349659e+5
#> 5 deviance       3.380460192e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.933590148e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(47.029) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.63424132  0.00379491 -694.15115          < 2.22e-16 ***
#> year.L      -0.19388264  0.01331919  -14.55664          < 2.22e-16 ***
#> year.Q      -0.09853273  0.01329936   -7.40883 0.00000000000012742 ***
#> year.C       0.01465584  0.01319804    1.11046          0.26680250    
#> year^4      -0.02233616  0.01322368   -1.68910          0.09119974 .  
#> year^5       0.01495000  0.01321981    1.13088          0.25810634    
#> year^6       0.04709845  0.01317008    3.57617          0.00034866 ***
#> year^7       0.02894606  0.01313051    2.20449          0.02748996 *  
#> year^8       0.01641733  0.01305828    1.25724          0.20866850    
#> year^9      -0.02147188  0.01298240   -1.65392          0.09814339 .  
#> year^10     -0.02379351  0.01297583   -1.83368          0.06670170 .  
#> year^11      0.01030478  0.01302273    0.79129          0.42877386    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0206   Deviance explained = 1.49%
#> -REML = -40561  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.062532839e-2 weak                   cohen1988
#> 2 SE       1.972876581e-3 <NA>                   <NA>     
#> 3 Lower CI 1.675856135e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.449209544e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.060348116e+4
#> 3 AIC           -8.118096232e+4
#> 4 BIC           -8.107800807e+4
#> 5 deviance       1.989046593e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.062532839e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(61.083) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value         Pr(>|z|)    
#> (Intercept) -2.684646160  0.009359123 -286.84803       < 2.22e-16 ***
#> year.L      -0.210167823  0.032975651   -6.37342 0.00000000018485 ***
#> year.Q      -0.092082220  0.032836320   -2.80428        0.0050429 ** 
#> year.C      -0.059427053  0.032764265   -1.81378        0.0697121 .  
#> year^4       0.003131789  0.032551557    0.09621        0.9233537    
#> year^5       0.064703168  0.032619275    1.98359        0.0473019 *  
#> year^6      -0.016697182  0.032525210   -0.51336        0.6076987    
#> year^7       0.064299439  0.032259521    1.99319        0.0462404 *  
#> year^8       0.050280508  0.032108191    1.56597        0.1173553    
#> year^9      -0.069140052  0.032116659   -2.15278        0.0313361 *  
#> year^10      0.014253882  0.032077071    0.44436        0.6567797    
#> year^11      0.011076706  0.031774920    0.34860        0.7273904    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0212   Deviance explained = 2.44%
#> -REML = -5871.2  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.117818155e-2 weak                   cohen1988
#> 2 SE       5.406166049e-3 <NA>                   <NA>     
#> 3 Lower CI 1.058229080e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.177407230e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.902573955e+3
#> 3 AIC           -1.177914791e+4
#> 4 BIC           -1.170210208e+4
#> 5 deviance       2.706397613e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.117818155e-2
#> 9 npar           1.2        e+1
Code
maper_mpepr_gam_5_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 195: Value of the coefficients in the maper_mpepr_gam_5_by_misfs model.
A B C D
[Mean] -0.2384089887 -0.2531576660 -0.2384904811 -0.2437012497
(Intercept) -2.7395348624 -3.1247032688 -2.6342413182 -2.6846461599
year.L 0.0823633804 0.1008634953 -0.1938826392 -0.2101678227
year.Q -0.2202149387 -0.0281354988 -0.0985327352 -0.0920822200
year.C -0.0711552193 -0.1050132546 0.0146558429 -0.0594270534
year^4 -0.0676222131 -0.2038445702 -0.0223361557 0.0031317894
year^5 -0.0048106947 0.0657077777 0.0149499977 0.0647031685
year^6 0.0618608881 0.0557860702 0.0470984492 -0.0166971821
year^7 -0.0058784895 0.0796080896 0.0289460634 0.0642994388
year^8 0.0943109810 0.0998921256 0.0164173331 0.0502805084
year^9 -0.0250489340 0.0035584476 -0.0214718792 -0.0691400520
year^10 -0.0039397290 0.0229543549 -0.0237935069 0.0142538824
year^11 0.0387619668 -0.0045657601 0.0103047747 0.0110767063

Source: Created by the authors.

Code
data |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_5_by_misfs,
    type = 5,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 217: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_5_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

By year (Unordered)

In this model, the year variable is treated as a unordered categorical variable.

Code
mbepr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.537) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value             Pr(>|z|)    
#> (Intercept) -3.09424687  0.03427877 -90.26715           < 2.22e-16 ***
#> year2009     0.35266775  0.04594284   7.67623 0.000000000000016384 ***
#> year2010     0.37775186  0.04580514   8.24693           < 2.22e-16 ***
#> year2011     0.23380479  0.04645506   5.03292 0.000000483054025019 ***
#> year2012     0.17344883  0.04675819   3.70949           0.00020768 ***
#> year2013     0.32506147  0.04600019   7.06653 0.000000000001588614 ***
#> year2014     0.45806746  0.04531048  10.10953           < 2.22e-16 ***
#> year2015     0.34842813  0.04585668   7.59820 0.000000000000030028 ***
#> year2016     0.48081092  0.04530151  10.61357           < 2.22e-16 ***
#> year2017     0.35239697  0.04594416   7.67011 0.000000000000017184 ***
#> year2018     0.41602966  0.04561816   9.11983           < 2.22e-16 ***
#> year2019     0.40761286  0.04556986   8.94479           < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0203   Deviance explained = 2.47%
#> -REML = -14556  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.458696428e+4
#> 3 AIC           -2.914792856e+4
#> 4 BIC           -2.905720269e+4
#> 5 deviance       8.119205011e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.027317837e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.507) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value          Pr(>|z|)    
#> (Intercept) -3.27874915  0.01784467 -183.73827        < 2.22e-16 ***
#> year2009     0.21482871  0.02452461    8.75972        < 2.22e-16 ***
#> year2010     0.24718735  0.02439970   10.13075        < 2.22e-16 ***
#> year2011     0.16598082  0.02461120    6.74412 0.000000000015396 ***
#> year2012     0.16136986  0.02463144    6.55138 0.000000000057009 ***
#> year2013     0.25333422  0.02467987   10.26481        < 2.22e-16 ***
#> year2014     0.29507924  0.02457929   12.00520        < 2.22e-16 ***
#> year2015     0.26164151  0.02452007   10.67050        < 2.22e-16 ***
#> year2016     0.29456981  0.02435031   12.09717        < 2.22e-16 ***
#> year2017     0.25769537  0.02443079   10.54797        < 2.22e-16 ***
#> year2018     0.21090578  0.02443018    8.63300        < 2.22e-16 ***
#> year2019     0.16330978  0.02446471    6.67532 0.000000000024669 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00456   Deviance explained = 0.764%
#> -REML = -68043  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.808076769e+4
#> 3 AIC           -1.361355354e+5
#> 4 BIC           -1.360267885e+5
#> 5 deviance       3.347652301e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -4.559784873e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(38.489) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.499558480  0.013918118 -179.59026 < 2.22e-16 ***
#> year2009     0.037046879  0.019339542    1.91560   0.055416 .  
#> year2010     0.008275972  0.019465924    0.42515   0.670726    
#> year2011    -0.049400274  0.019628098   -2.51681   0.011842 *  
#> year2012    -0.177700784  0.019984739   -8.89182 < 2.22e-16 ***
#> year2013    -0.126004996  0.019933730   -6.32119 2.5955e-10 ***
#> year2014    -0.096231615  0.019786308   -4.86355 1.1530e-06 ***
#> year2015    -0.202062015  0.020140317  -10.03271 < 2.22e-16 ***
#> year2016    -0.105372594  0.019764896   -5.33130 9.7512e-08 ***
#> year2017    -0.158609478  0.019990019   -7.93443 2.1146e-15 ***
#> year2018    -0.184771030  0.020194355   -9.14964 < 2.22e-16 ***
#> year2019    -0.163958341  0.020023947   -8.18811 2.6535e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0285   Deviance explained = 1.87%
#> -REML = -38671  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       2.851689999e-2 weak           cohen1988
#> 2 SE       2.301108092e-3 <NA>           <NA>     
#> 3 Lower CI 2.400681100e-2 weak           cohen1988
#> 4 Upper CI 3.302698897e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.871102690e+4
#> 3 AIC           -7.739605379e+4
#> 4 BIC           -7.729309954e+4
#> 5 deviance       1.976947966e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.851689999e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(35.093) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value         Pr(>|z|)    
#> (Intercept) -2.08278548  0.03440989 -60.52869       < 2.22e-16 ***
#> year2009     0.03529121  0.04785209   0.73751       0.46081461    
#> year2010    -0.05957442  0.04833477  -1.23254       0.21774829    
#> year2011    -0.12840640  0.04889270  -2.62629       0.00863212 ** 
#> year2012    -0.32476414  0.05060426  -6.41772 0.00000000013833 ***
#> year2013    -0.16655027  0.04905061  -3.39548       0.00068509 ***
#> year2014    -0.12211249  0.04873553  -2.50562       0.01222385 *  
#> year2015    -0.32146788  0.05034339  -6.38550 0.00000000017083 ***
#> year2016    -0.27119000  0.05000667  -5.42308 0.00000005858187 ***
#> year2017    -0.28255052  0.05016444  -5.63249 0.00000001776299 ***
#> year2018    -0.29671761  0.05046571  -5.87959 0.00000000411288 ***
#> year2019    -0.28605072  0.05048667  -5.66587 0.00000001462836 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0455   Deviance explained = 5.16%
#> -REML = -4658.7  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.545270470e-2 weak           cohen1988
#> 2 SE       7.723581311e-3 <NA>           <NA>     
#> 3 Lower CI 3.031476350e-2 weak           cohen1988
#> 4 Upper CI 6.059064590e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.687741024e+3
#> 3 AIC           -9.349482048e+3
#> 4 BIC           -9.272436214e+3
#> 5 deviance       2.677966059e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  4.545270470e-2
#> 9 npar           1.2        e+1
Code
mbepr_gam_6_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 196: Value of the coefficients in the mbepr_gam_6_by_misfs model.
A B C D
[Mean] 0.0693194859 -0.0627372249 -0.3098622298 -0.3589065592
(Intercept) -3.0942468670 -3.2787491509 -2.4995584805 -2.0827854800
year2009 0.3526677517 0.2148287090 0.0370468786 0.0352912122
year2010 0.3777518618 0.2471873542 0.0082759720 -0.0595744214
year2011 0.2338047861 0.1659808185 -0.0494002741 -0.1284064023
year2012 0.1734488271 0.1613698600 -0.1777007842 -0.3247641446
year2013 0.3250614706 0.2533342166 -0.1260049959 -0.1665502666
year2014 0.4580674583 0.2950792367 -0.0962316150 -0.1221124850
year2015 0.3484281296 0.2616415114 -0.2020620149 -0.3214678849
year2016 0.4808109223 0.2945698147 -0.1053725942 -0.2711899981
year2017 0.3523969699 0.2576953696 -0.1586094778 -0.2825505162
year2018 0.4160296607 0.2109057842 -0.1847710302 -0.2967176079
year2019 0.4076128594 0.1633097776 -0.1639583411 -0.2860507157

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR"
  )
Figure 218: Predicted probability of MBEPR (Very Short Stature for Age (Muito Baixa Estatura Para a Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
beipr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(beipr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(beipr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.127) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value             Pr(>|z|)    
#> (Intercept) -2.814996853  0.029385414 -95.79572           < 2.22e-16 ***
#> year2009     0.047204010  0.040554582   1.16396           0.24443923    
#> year2010     0.102321228  0.040240677   2.54273           0.01099898 *  
#> year2011     0.046227261  0.040502004   1.14136           0.25372123    
#> year2012    -0.009950727  0.040823058  -0.24375           0.80742243    
#> year2013     0.140876019  0.039977469   3.52389           0.00042527 ***
#> year2014     0.237032038  0.039429416   6.01155 0.000000001837540166 ***
#> year2015     0.265927609  0.039292365   6.76792 0.000000000013064633 ***
#> year2016     0.222930104  0.039596063   5.63011 0.000000018009694788 ***
#> year2017     0.256683443  0.039432108   6.50950 0.000000000075399663 ***
#> year2018     0.334969482  0.039014454   8.58578           < 2.22e-16 ***
#> year2019     0.291545019  0.039160268   7.44492 0.000000000000097004 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0299   Deviance explained = 2.71%
#> -REML = -14283  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.431571354e+4
#> 3 AIC           -2.860542709e+4
#> 4 BIC           -2.851470122e+4
#> 5 deviance       8.071957558e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -2.986476328e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.666) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value            Pr(>|z|)    
#> (Intercept) -2.99950260  0.01547685 -193.80571          < 2.22e-16 ***
#> year2009     0.14475768  0.02124917    6.81239 0.00000000000959884 ***
#> year2010     0.19377589  0.02106989    9.19681          < 2.22e-16 ***
#> year2011     0.08340476  0.02140071    3.89729 0.00009727491473461 ***
#> year2012     0.03057329  0.02155042    1.41869             0.15599    
#> year2013     0.15642915  0.02142306    7.30191 0.00000000000028372 ***
#> year2014     0.15686446  0.02141386    7.32537 0.00000000000023824 ***
#> year2015     0.23925807  0.02107722   11.35150          < 2.22e-16 ***
#> year2016     0.19448747  0.02111164    9.21233          < 2.22e-16 ***
#> year2017     0.23472074  0.02100701   11.17345          < 2.22e-16 ***
#> year2018     0.20006704  0.02101582    9.51983          < 2.22e-16 ***
#> year2019     0.17884706  0.02101990    8.50846          < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0159   Deviance explained = 0.926%
#> -REML = -61292  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.133176478e+4
#> 3 AIC           -1.226375296e+5
#> 4 BIC           -1.225287827e+5
#> 5 deviance       3.310622465e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -1.591864228e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(72.251) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.38640477  0.01011229 -235.99050 < 2.22e-16 ***
#> year2009     0.01240122  0.01410606    0.87914    0.37932    
#> year2010    -0.05868963  0.01431967   -4.09853 4.1578e-05 ***
#> year2011    -0.10144465  0.01441618   -7.03686 1.9662e-12 ***
#> year2012    -0.20262047  0.01464463  -13.83582 < 2.22e-16 ***
#> year2013    -0.14515340  0.01457319   -9.96031 < 2.22e-16 ***
#> year2014    -0.15512159  0.01456849  -10.64775 < 2.22e-16 ***
#> year2015    -0.15588298  0.01455961  -10.70654 < 2.22e-16 ***
#> year2016    -0.18318271  0.01460994  -12.53822 < 2.22e-16 ***
#> year2017    -0.14812384  0.01453951  -10.18768 < 2.22e-16 ***
#> year2018    -0.11299046  0.01451904   -7.78223 7.1258e-15 ***
#> year2019    -0.13869570  0.01452353   -9.54972 < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.036   Deviance explained = 2.34%
#> -REML = -42820  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       3.600156273e-2 weak           cohen1988
#> 2 SE       2.565592159e-3 <NA>           <NA>     
#> 3 Lower CI 3.097309450e-2 weak           cohen1988
#> 4 Upper CI 4.103003096e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.286366655e+4
#> 3 AIC           -8.570133310e+4
#> 4 BIC           -8.559837885e+4
#> 5 deviance       2.003054550e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  3.600156273e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(52.212) 
#> Link function: logit 
#> 
#> Formula:
#> beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value    Pr(>|z|)    
#> (Intercept) -1.86640997  0.02671057 -69.87533  < 2.22e-16 ***
#> year2009     0.08173551  0.03687128   2.21678  0.02663815 *  
#> year2010     0.04524564  0.03689117   1.22646  0.22002464    
#> year2011    -0.02904872  0.03733563  -0.77804  0.43654365    
#> year2012    -0.09208464  0.03773260  -2.44045  0.01466885 *  
#> year2013    -0.04816000  0.03733637  -1.28990  0.19708708    
#> year2014    -0.06393338  0.03747366  -1.70609  0.08799159 .  
#> year2015    -0.13017766  0.03781844  -3.44217  0.00057706 ***
#> year2016    -0.14931515  0.03802615  -3.92664 0.000086139 ***
#> year2017    -0.11293230  0.03782711  -2.98549  0.00283128 ** 
#> year2018    -0.10408259  0.03789251  -2.74679  0.00601826 ** 
#> year2019    -0.11058879  0.03801898  -2.90878  0.00362844 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0327   Deviance explained = 2.94%
#> -REML = -4686.6  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       3.271189059e-2 weak                   cohen1988
#> 2 SE       6.639724773e-3 <NA>                   <NA>     
#> 3 Lower CI 1.969826917e-2 very weak (negligible) cohen1988
#> 4 Upper CI 4.572551202e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.719121470e+3
#> 3 AIC           -9.412242941e+3
#> 4 BIC           -9.335197107e+3
#> 5 deviance       2.714505806e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  3.271189059e-2
#> 9 npar           1.2        e+1
Code
beipr_gam_6_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 197: Value of the coefficients in the beipr_gam_6_by_misfs model.
A B C D
[Mean] -0.0732692806 -0.0988597485 -0.3146590824 -0.2149793375
(Intercept) -2.8149968533 -2.9995026026 -2.3864047732 -1.8664099721
year2009 0.0472040103 0.1447576844 0.0124012174 0.0817355101
year2010 0.1023212283 0.1937758873 -0.0586896332 0.0452456421
year2011 0.0462272613 0.0834047646 -0.1014446494 -0.0290487244
year2012 -0.0099507266 0.0305732904 -0.2026204683 -0.0920846360
year2013 0.1408760186 0.1564291540 -0.1451534035 -0.0481600037
year2014 0.2370320376 0.1568644566 -0.1551215863 -0.0639333834
year2015 0.2659276085 0.2392580691 -0.1558829841 -0.1301776573
year2016 0.2229301040 0.1944874677 -0.1831827111 -0.1493151452
year2017 0.2566834431 0.2347207432 -0.1481238355 -0.1129323015
year2018 0.3349694817 0.2000670429 -0.1129904588 -0.1040825865
year2019 0.2915450188 0.1788470608 -0.1386957024 -0.1105887918

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = beipr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of BEIPR"
  )
Figure 219: Predicted probability of BEIPR (Short Stature for Age (Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the beipr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mbepr_beipr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mbepr_beipr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mbepr_beipr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(17.202) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value           Pr(>|z|)    
#> (Intercept) -2.08080565  0.02740893 -75.91707         < 2.22e-16 ***
#> year2009     0.19055073  0.03715369   5.12872 0.0000002917242204 ***
#> year2010     0.15908459  0.03728661   4.26653 0.0000198532878715 ***
#> year2011     0.07512878  0.03764546   1.99569           0.045967 *  
#> year2012     0.02408713  0.03790746   0.63542           0.525155    
#> year2013     0.15950743  0.03723322   4.28401 0.0000183555587381 ***
#> year2014     0.26091254  0.03673717   7.10214 0.0000000000012284 ***
#> year2015     0.17356083  0.03714285   4.67279 0.0000029713107767 ***
#> year2016     0.21454511  0.03703127   5.79362 0.0000000068885232 ***
#> year2017     0.16408621  0.03727622   4.40190 0.0000107306762664 ***
#> year2018     0.20961319  0.03705370   5.65701 0.0000000154032438 ***
#> year2019     0.20497947  0.03699936   5.54008 0.0000000302331853 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.011   Deviance explained = 1.35%
#> -REML = -9871.3  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.904385109e+3
#> 3 AIC           -1.978277022e+4
#> 4 BIC           -1.969204436e+4
#> 5 deviance       7.756093795e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.096589072e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(16.45) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.31712574  0.01459629 -158.74759 < 2.22e-16 ***
#> year2009     0.15600119  0.02000904    7.79654 6.3629e-15 ***
#> year2010     0.16915137  0.01992975    8.48738 < 2.22e-16 ***
#> year2011     0.07958637  0.02018918    3.94203 8.0795e-05 ***
#> year2012     0.03616871  0.02030823    1.78099   0.074914 .  
#> year2013     0.14323144  0.02023487    7.07845 1.4578e-12 ***
#> year2014     0.16235850  0.02017847    8.04612 8.5458e-16 ***
#> year2015     0.17061424  0.02004920    8.50978 < 2.22e-16 ***
#> year2016     0.13893044  0.02004608    6.93056 4.1919e-12 ***
#> year2017     0.14243165  0.02003915    7.10767 1.1802e-12 ***
#> year2018     0.10490315  0.02005155    5.23167 1.6798e-07 ***
#> year2019     0.08060366  0.02006139    4.01785 5.8731e-05 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00237   Deviance explained = 0.56%
#> -REML = -44228  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.426792248e+4
#> 3 AIC           -8.850984496e+4
#> 4 BIC           -8.840109809e+4
#> 5 deviance       3.182959169e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.365279760e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(32.314) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value         Pr(>|z|)    
#> (Intercept) -1.62203590  0.01128229 -143.76834       < 2.22e-16 ***
#> year2009     0.01927930  0.01573038    1.22561       0.22034559    
#> year2010    -0.05501702  0.01593038   -3.45359       0.00055317 ***
#> year2011    -0.09989673  0.01601573   -6.23741 0.00000000044487 ***
#> year2012    -0.22444470  0.01626701  -13.79754       < 2.22e-16 ***
#> year2013    -0.19058010  0.01628383  -11.70364       < 2.22e-16 ***
#> year2014    -0.18134686  0.01622227  -11.17889       < 2.22e-16 ***
#> year2015    -0.24526825  0.01638007  -14.97358       < 2.22e-16 ***
#> year2016    -0.21094895  0.01625574  -12.97689       < 2.22e-16 ***
#> year2017    -0.21671607  0.01630568  -13.29084       < 2.22e-16 ***
#> year2018    -0.21346543  0.01638834  -13.02545       < 2.22e-16 ***
#> year2019    -0.21544144  0.01631477  -13.20530       < 2.22e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0434   Deviance explained = 3.53%
#> -REML = -28928  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       4.335752981e-2 weak           cohen1988
#> 2 SE       2.794039468e-3 <NA>           <NA>     
#> 3 Lower CI 3.788131308e-2 weak           cohen1988
#> 4 Upper CI 4.883374654e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.897004590e+4
#> 3 AIC           -5.791409181e+4
#> 4 BIC           -5.781113756e+4
#> 5 deviance       1.982049212e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  4.335752981e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(24.343) 
#> Link function: logit 
#> 
#> Formula:
#> mbepr_beipr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value          Pr(>|z|)    
#> (Intercept) -1.09220914  0.03064617 -35.63934        < 2.22e-16 ***
#> year2009     0.04616821  0.04265173   1.08245        0.27905426    
#> year2010    -0.03670936  0.04280411  -0.85761        0.39110617    
#> year2011    -0.11280096  0.04317714  -2.61252        0.00898785 ** 
#> year2012    -0.22979138  0.04380484  -5.24580 0.000000155606953 ***
#> year2013    -0.15380095  0.04325058  -3.55604        0.00037648 ***
#> year2014    -0.14568177  0.04325413  -3.36804        0.00075704 ***
#> year2015    -0.29194788  0.04397095  -6.63956 0.000000000031461 ***
#> year2016    -0.28216332  0.04400982  -6.41137 0.000000000144216 ***
#> year2017    -0.26159951  0.04393841  -5.95378 0.000000002620232 ***
#> year2018    -0.26558406  0.04410863  -6.02114 0.000000001731977 ***
#> year2019    -0.25983777  0.04417477  -5.88204 0.000000004052398 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0573   Deviance explained = 5.65%
#> -REML = -3039.2  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation rule     
#>   <chr>             <dbl> <chr>          <chr>    
#> 1 R2       5.729349284e-2 weak           cohen1988
#> 2 SE       8.563879749e-3 <NA>           <NA>     
#> 3 Lower CI 4.050859696e-2 weak           cohen1988
#> 4 Upper CI 7.407838871e-2 weak           cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         3.069860234e+3
#> 3 AIC           -6.113720467e+3
#> 4 BIC           -6.036674633e+3
#> 5 deviance       2.685543298e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.729349284e-2
#> 9 npar           1.2        e+1
Code
mbepr_beipr_gam_6_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 198: Value of the coefficients in the mbepr_beipr_gam_6_by_misfs model.
A B C D
[Mean] -0.0203958017 -0.0777620861 -0.2879901788 -0.2571631576
(Intercept) -2.0808056463 -2.3171257437 -1.6220358970 -1.0922091421
year2009 0.1905507318 0.1560011856 0.0192793047 0.0461682098
year2010 0.1590845870 0.1691513728 -0.0550170208 -0.0367093630
year2011 0.0751287833 0.0795863688 -0.0998967255 -0.1128009579
year2012 0.0240871308 0.0361687071 -0.2244446969 -0.2297913759
year2013 0.1595074335 0.1432314421 -0.1905801023 -0.1538009465
year2014 0.2609125365 0.1623584957 -0.1813468627 -0.1456817711
year2015 0.1735608334 0.1706142407 -0.2452682543 -0.2919478833
year2016 0.2145451149 0.1389304403 -0.2109489477 -0.2821633165
year2017 0.1640862149 0.1424316464 -0.2167160681 -0.2615995078
year2018 0.2096131895 0.1049031496 -0.2134654302 -0.2655840638
year2019 0.2049794702 0.0806036609 -0.2154414446 -0.2598377727

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mbepr_beipr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MBEPR & BEIPR"
  )
#> Warning: Removed 12 rows containing missing values or values outside the scale range
#> (`geom_line()`).
#> Warning in max(ids, na.rm = TRUE): no non-missing arguments to max;
#> returning -Inf
Figure 220: Predicted probability of MBEPR & BEIPR (Very Short/Short Stature for Age (Muito Baixa/Baixa Estatura Para Idade)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mbepr_beipr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.761) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value        Pr(>|z|)    
#> (Intercept) -3.69189376  0.03615554 -102.11142      < 2.22e-16 ***
#> year2009     0.09122742  0.04986873    1.82935      0.06734703 .  
#> year2010     0.22634146  0.04929874    4.59122 0.0000044065745 ***
#> year2011     0.14027588  0.04960297    2.82797      0.00468437 ** 
#> year2012     0.09591483  0.04979698    1.92612      0.05408972 .  
#> year2013     0.18389314  0.04940769    3.72195      0.00019769 ***
#> year2014     0.25367268  0.04906371    5.17027 0.0000002337548 ***
#> year2015     0.19574918  0.04932437    3.96861 0.0000722931747 ***
#> year2016     0.27178813  0.04910363    5.53499 0.0000000311244 ***
#> year2017     0.30595451  0.04897093    6.24768 0.0000000004166 ***
#> year2018     0.10464789  0.04979804    2.10145      0.03560184 *  
#> year2019     0.07242936  0.04981757    1.45389      0.14597627    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0079   Deviance explained = 0.957%
#> -REML = -20717  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         2.074635089e+4
#> 3 AIC           -4.146670177e+4
#> 4 BIC           -4.137597591e+4
#> 5 deviance       8.433850322e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -7.903895660e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.009) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -4.05354613  0.01869655 -216.80719 < 2.22e-16 ***
#> year2009     0.09788021  0.02600527    3.76386 0.00016731 ***
#> year2010     0.12848812  0.02589950    4.96103 7.0122e-07 ***
#> year2011     0.04325298  0.02606435    1.65947 0.09702129 .  
#> year2012     0.04013462  0.02608028    1.53889 0.12383179    
#> year2013     0.12026109  0.02623224    4.58448 4.5512e-06 ***
#> year2014     0.13745562  0.02619691    5.24702 1.5458e-07 ***
#> year2015     0.14778681  0.02603662    5.67611 1.3779e-08 ***
#> year2016     0.20454883  0.02584291    7.91508 2.4709e-15 ***
#> year2017     0.25107458  0.02577241    9.74199 < 2.22e-16 ***
#> year2018     0.06605114  0.02593643    2.54666 0.01087608 *  
#> year2019     0.03303157  0.02591281    1.27472 0.20240838    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00248   Deviance explained = 0.544%
#> -REML = -1.0446e+05  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.044996352e+5
#> 3 AIC           -2.089732704e+5
#> 4 BIC           -2.088645236e+5
#> 5 deviance       3.427644493e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.481012795e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(51.613) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value        Pr(>|z|)    
#> (Intercept) -3.408513575  0.016886593 -201.84732      < 2.22e-16 ***
#> year2009     0.042954427  0.023451102    1.83166      0.06700221 .  
#> year2010     0.096767078  0.023293388    4.15427 0.0000326324264 ***
#> year2011     0.078873109  0.023326080    3.38133      0.00072137 ***
#> year2012    -0.037792157  0.023661468   -1.59720      0.11022057    
#> year2013     0.088124473  0.023341460    3.77545      0.00015972 ***
#> year2014     0.045458354  0.023448534    1.93864      0.05254473 .  
#> year2015    -0.006662832  0.023624112   -0.28204      0.77791649    
#> year2016     0.053338508  0.023360606    2.28327      0.02241462 *  
#> year2017    -0.012634456  0.023649633   -0.53423      0.59317911    
#> year2018    -0.144093365  0.024273710   -5.93619 0.0000000029172 ***
#> year2019    -0.109638973  0.024029463   -4.56269 0.0000050502521 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0109   Deviance explained = 1.15%
#> -REML = -50952  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       1.094496673e-2 very weak (negligible) cohen1988
#> 2 SE       1.451370507e-3 <NA>                   <NA>     
#> 3 Lower CI 8.100332809e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.378960065e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.098980161e+4
#> 3 AIC           -1.019536032e+5
#> 4 BIC           -1.018506490e+5
#> 5 deviance       2.004505690e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  1.094496673e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(84.23) 
#> Link function: logit 
#> 
#> Formula:
#> maper ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value    Pr(>|z|)    
#> (Intercept) -3.434525093  0.038704222 -88.73774  < 2.22e-16 ***
#> year2009     0.033982608  0.053795474   0.63170    0.527583    
#> year2010    -0.028244284  0.054120830  -0.52187    0.601758    
#> year2011    -0.096589965  0.054803074  -1.76249    0.077986 .  
#> year2012    -0.117281161  0.055012953  -2.13188    0.033016 *  
#> year2013     0.003471375  0.053644187   0.06471    0.948404    
#> year2014    -0.053131949  0.054252554  -0.97934    0.327410    
#> year2015    -0.065479155  0.054261095  -1.20674    0.227531    
#> year2016    -0.042010091  0.054142851  -0.77591    0.437801    
#> year2017    -0.095929383  0.054737443  -1.75254    0.079682 .  
#> year2018    -0.251238746  0.056535565  -4.44391 0.000008834 ***
#> year2019    -0.257736758  0.056737006  -4.54266 0.000005555 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0202   Deviance explained = 2.23%
#> -REML = -7542.3  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.021475971e-2 weak                   cohen1988
#> 2 SE       5.286966888e-3 <NA>                   <NA>     
#> 3 Lower CI 9.852495026e-3 very weak (negligible) cohen1988
#> 4 Upper CI 3.057702440e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.570286498e+3
#> 3 AIC           -1.511457300e+4
#> 4 BIC           -1.503752716e+4
#> 5 deviance       2.705752165e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.021475971e-2
#> 9 npar           1.2        e+1
Code
maper_gam_6_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 199: Value of the coefficients in the maper_gam_6_by_misfs model.
A B C D
[Mean] -0.1458332730 -0.2319650464 -0.2761516176 -0.3670593835
(Intercept) -3.6918937623 -4.0535461290 -3.4085135751 -3.4345250931
year2009 0.0912274236 0.0978802057 0.0429544267 0.0339826078
year2010 0.2263414641 0.1284881180 0.0967670777 -0.0282442836
year2011 0.1402758760 0.0432529831 0.0788731092 -0.0965899649
year2012 0.0959148332 0.0401346192 -0.0377921574 -0.1172811614
year2013 0.1838931362 0.1202610933 0.0881244725 0.0034713755
year2014 0.2536726770 0.1374556199 0.0454583536 -0.0531319495
year2015 0.1957491799 0.1477868125 -0.0066628319 -0.0654791553
year2016 0.2717881343 0.2045488276 0.0533385081 -0.0420100906
year2017 0.3059545102 0.2510745771 -0.0126344565 -0.0959293826
year2018 0.1046478886 0.0660511420 -0.1440933654 -0.2512387463
year2019 0.0724293635 0.0330315736 -0.1096389733 -0.2577367577

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER"
  )
Figure 221: Predicted probability of MAPER (Severe Thinness for Height (Magreza Acentuada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
mpepr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(mpepr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(mpepr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(31.103) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value             Pr(>|z|)    
#> (Intercept) -3.62582314  0.03381049 -107.23960           < 2.22e-16 ***
#> year2009     0.03709332  0.04678136    0.79291           0.42783140    
#> year2010     0.19467109  0.04598557    4.23331 0.000023027810392995 ***
#> year2011     0.17097103  0.04605697    3.71216           0.00020549 ***
#> year2012     0.10822804  0.04638477    2.33327           0.01963416 *  
#> year2013     0.25702475  0.04560643    5.63571 0.000000017433585354 ***
#> year2014     0.16856564  0.04600552    3.66403           0.00024828 ***
#> year2015     0.34169192  0.04514264    7.56916 0.000000000000037564 ***
#> year2016     0.32731720  0.04530662    7.22449 0.000000000000502985 ***
#> year2017     0.39819008  0.04495368    8.85779           < 2.22e-16 ***
#> year2018     0.31330313  0.04537902    6.90414 0.000000000005050802 ***
#> year2019     0.17679795  0.04598024    3.84509           0.00012051 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0362   Deviance explained = 2.05%
#> -REML = -19442  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.947212870e+4
#> 3 AIC           -3.891825739e+4
#> 4 BIC           -3.882753153e+4
#> 5 deviance       8.411778743e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -3.620918501e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(25.906) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -3.87698948  0.01801987 -215.15081 < 2.22e-16 ***
#> year2009     0.10877974  0.02499283    4.35244 1.3463e-05 ***
#> year2010     0.15731129  0.02484095    6.33274 2.4084e-10 ***
#> year2011     0.08050945  0.02503152    3.21632  0.0012984 ** 
#> year2012     0.04868841  0.02510033    1.93975  0.0524099 .  
#> year2013     0.05472442  0.02534252    2.15939  0.0308198 *  
#> year2014     0.07020751  0.02530395    2.77457  0.0055275 ** 
#> year2015     0.14517931  0.02502139    5.80221 6.5447e-09 ***
#> year2016     0.25393209  0.02470121   10.28015 < 2.22e-16 ***
#> year2017     0.37762169  0.02444039   15.45073 < 2.22e-16 ***
#> year2018     0.20054394  0.02471163    8.11537 4.8433e-16 ***
#> year2019     0.15884431  0.02473039    6.42304 1.3358e-10 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00743   Deviance explained = 1.15%
#> -REML = -90887  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         9.092481949e+4
#> 3 AIC           -1.818236390e+5
#> 4 BIC           -1.817148921e+5
#> 5 deviance       3.487532075e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -7.427616944e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(87.973) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error    z value       Pr(>|z|)    
#> (Intercept) -3.371412963  0.013565837 -248.52229     < 2.22e-16 ***
#> year2009     0.025612204  0.018876649    1.35682     0.17483858    
#> year2010     0.089615821  0.018687209    4.79557 0.000001622127 ***
#> year2011     0.094320584  0.018645222    5.05870 0.000000422124 ***
#> year2012     0.100801844  0.018552323    5.43338 0.000000055296 ***
#> year2013     0.073971800  0.018754045    3.94431 0.000080029524 ***
#> year2014     0.029271255  0.018869216    1.55127     0.12083690    
#> year2015     0.054841548  0.018767180    2.92221     0.00347563 ** 
#> year2016     0.070027834  0.018681384    3.74854     0.00017787 ***
#> year2017     0.019208516  0.018893706    1.01666     0.30931416    
#> year2018     0.001710287  0.019054804    0.08976     0.92848093    
#> year2019    -0.053550519  0.019166898   -2.79391     0.00520755 ** 
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00809   Deviance explained = 0.688%
#> -REML = -53470  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       8.093105311e-3 very weak (negligible) cohen1988
#> 2 SE       1.251639090e-3 <NA>                   <NA>     
#> 3 Lower CI 5.639937773e-3 very weak (negligible) cohen1988
#> 4 Upper CI 1.054627285e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.351150485e+4
#> 3 AIC           -1.069970097e+5
#> 4 BIC           -1.068940554e+5
#> 5 deviance       2.017974368e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  8.093105311e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(117.623) 
#> Link function: logit 
#> 
#> Formula:
#> mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value Pr(>|z|)    
#> (Intercept) -3.32141304  0.03214613 -103.32232  < 2e-16 ***
#> year2009     0.05759784  0.04445372    1.29568 0.195085    
#> year2010     0.05320486  0.04426187    1.20205 0.229345    
#> year2011    -0.06310094  0.04528226   -1.39350 0.163468    
#> year2012     0.03727906  0.04439777    0.83966 0.401099    
#> year2013     0.08400974  0.04387130    1.91491 0.055504 .  
#> year2014     0.02121784  0.04444479    0.47740 0.633079    
#> year2015     0.01473267  0.04441036    0.33174 0.740086    
#> year2016     0.03800192  0.04430125    0.85781 0.390999    
#> year2017    -0.02280729  0.04487438   -0.50825 0.611280    
#> year2018    -0.08232164  0.04555579   -1.80705 0.070754 .  
#> year2019    -0.08903243  0.04571826   -1.94742 0.051485 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.00546   Deviance explained = 1.33%
#> -REML = -7566.8  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name               value interpretation         rule     
#>   <chr>              <dbl> <chr>                  <chr>    
#> 1 R2        5.458795517e-3 very weak (negligible) cohen1988
#> 2 SE        2.788769371e-3 <NA>                   <NA>     
#> 3 Lower CI -7.092011279e-6 no effect              cohen1988
#> 4 Upper CI  1.092468305e-2 very weak (negligible) cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         7.597365316e+3
#> 3 AIC           -1.516873063e+4
#> 4 BIC           -1.509168480e+4
#> 5 deviance       2.718494668e+3
#> 6 df.residual    2.758      e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  5.458795517e-3
#> 9 npar           1.2        e+1
Code
mpepr_gam_6_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 200: Value of the coefficients in the mpepr_gam_6_by_misfs model.
A B C D
[Mean] -0.0943307491 -0.1850539438 -0.2387984823 -0.2727192850
(Intercept) -3.6258231393 -3.8769894763 -3.3714129630 -3.3214130378
year2009 0.0370933154 0.1087797385 0.0256122042 0.0575978433
year2010 0.1946710948 0.1573112884 0.0896158214 0.0532048557
year2011 0.1709710272 0.0805094531 0.0943205838 -0.0631009415
year2012 0.1082280369 0.0486884117 0.1008018444 0.0372790615
year2013 0.2570247511 0.0547244181 0.0739717996 0.0840097367
year2014 0.1685656423 0.0702075082 0.0292712554 0.0212178384
year2015 0.3416919159 0.1451793123 0.0548415480 0.0147326707
year2016 0.3273172011 0.2539320903 0.0700278339 0.0380019201
year2017 0.3981900819 0.3776216889 0.0192085160 -0.0228072923
year2018 0.3133031313 0.2005439360 0.0017102875 -0.0823216449
year2019 0.1767979519 0.1588443050 -0.0535505189 -0.0890324293

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = mpepr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MPEPR"
  )
Figure 222: Predicted probability of MPEPR (Thinness for Height (Magreza Por Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the mpepr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Code
maper_mpepr_gam_6_by_misfs <-
  dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  gam_misfs(maper_mpepr ~ year)
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  summarise_gam_misfs(maper_mpepr_gam_6_by_misfs)
#> 
#> ── Model A ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(23.539) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                 Estimate   Std. Error   z value        Pr(>|z|)    
#> (Intercept) -2.863762847  0.030416313 -94.15220      < 2.22e-16 ***
#> year2009     0.002530356  0.042231157   0.05992       0.9522219    
#> year2010     0.163563687  0.041353669   3.95524 0.0000764578584 ***
#> year2011     0.124535353  0.041518057   2.99955       0.0027038 ** 
#> year2012     0.107157267  0.041625158   2.57434       0.0100432 *  
#> year2013     0.200257644  0.041103161   4.87207 0.0000011043276 ***
#> year2014     0.163105950  0.041256803   3.95343 0.0000770382914 ***
#> year2015     0.188558211  0.041136809   4.58369 0.0000045685023 ***
#> year2016     0.213264848  0.041090556   5.19012 0.0000002101605 ***
#> year2017     0.237457486  0.040977146   5.79488 0.0000000068372 ***
#> year2018     0.084345817  0.041776517   2.01898       0.0434896 *  
#> year2019     0.005959200  0.042106384   0.14153       0.8874534    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.0105   Deviance explained = 1.21%
#> -REML = -14641  Scale est. = 1         n = 7934
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         1.467225123e+4
#> 3 AIC           -2.931850246e+4
#> 4 BIC           -2.922777659e+4
#> 5 deviance       8.012581771e+3
#> 6 df.residual    7.922      e+3
#> 7 nobs           7.93400    e+3
#> 8 adj.r.squared -1.046017779e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model B ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(18.318) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value         Pr(>|z|)    
#> (Intercept) -3.22294516  0.01732431 -186.03595       < 2.22e-16 ***
#> year2009     0.11971504  0.02395965    4.99653 0.00000058372166 ***
#> year2010     0.15009620  0.02383549    6.29717 0.00000000030312 ***
#> year2011     0.03535440  0.02412842    1.46526         0.142850    
#> year2012     0.02856854  0.02415370    1.18278         0.236896    
#> year2013     0.03868681  0.02437592    1.58709         0.112492    
#> year2014     0.05914037  0.02432167    2.43159         0.015033 *  
#> year2015     0.09944464  0.02409824    4.12663 0.00003681107791 ***
#> year2016     0.20107932  0.02377157    8.45882       < 2.22e-16 ***
#> year2017     0.31640490  0.02350747   13.45976       < 2.22e-16 ***
#> year2018     0.08533299  0.02393219    3.56562         0.000363 ***
#> year2019     0.04507955  0.02395628    1.88174         0.059871 .  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  -0.00293   Deviance explained = 0.958%
#> -REML = -69447  Scale est. = 1         n = 31734
#> 
#> # A tibble: 4 × 4
#>   name     value interpretation rule     
#>   <chr>    <dbl> <chr>          <chr>    
#> 1 R2           0 no effect      cohen1988
#> 2 SE           0 <NA>           <NA>     
#> 3 Lower CI     0 no effect      cohen1988
#> 4 Upper CI     0 no effect      cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         6.948485640e+4
#> 3 AIC           -1.389437128e+5
#> 4 BIC           -1.388349659e+5
#> 5 deviance       3.380460192e+4
#> 6 df.residual    3.1722     e+4
#> 7 nobs           3.1734     e+4
#> 8 adj.r.squared -2.933590148e-3
#> 9 npar           1.2        e+1
#> 
#> ── Model C ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(47.029) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error    z value   Pr(>|z|)    
#> (Intercept) -2.60735423  0.01328347 -196.28559 < 2.22e-16 ***
#> year2009     0.02135162  0.01850311    1.15395 0.24852164    
#> year2010     0.04981589  0.01844381    2.70095 0.00691407 ** 
#> year2011     0.04486920  0.01843335    2.43413 0.01492754 *  
#> year2012     0.01463898  0.01845685    0.79315 0.42769265    
#> year2013     0.02003883  0.01855254    1.08011 0.28009207    
#> year2014    -0.03307472  0.01868558   -1.77007 0.07671606 .  
#> year2015    -0.04951833  0.01872640   -2.64431 0.00818587 ** 
#> year2016    -0.01531973  0.01857922   -0.82456 0.40962004    
#> year2017    -0.06723362  0.01878823   -3.57850 0.00034558 ***
#> year2018    -0.15569399  0.01919680   -8.11041 5.0449e-16 ***
#> year2019    -0.15251919  0.01909421   -7.98772 1.3746e-15 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0206   Deviance explained = 1.49%
#> -REML = -40563  Scale est. = 1         n = 20324
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.062532839e-2 weak                   cohen1988
#> 2 SE       1.972876581e-3 <NA>                   <NA>     
#> 3 Lower CI 1.675856135e-2 very weak (negligible) cohen1988
#> 4 Upper CI 2.449209544e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         4.060348116e+4
#> 3 AIC           -8.118096232e+4
#> 4 BIC           -8.107800807e+4
#> 5 deviance       1.989046593e+4
#> 6 df.residual    2.03120000 e+4
#> 7 nobs           2.0324     e+4
#> 8 adj.r.squared  2.062532839e-2
#> 9 npar           1.2        e+1
#> 
#> ── Model D ──────────────────────────────────────────────────────────────────
#> 
#> Family: Beta regression(61.083) 
#> Link function: logit 
#> 
#> Formula:
#> maper_mpepr ~ year
#> 
#> Parametric coefficients:
#>                Estimate  Std. Error   z value    Pr(>|z|)    
#> (Intercept) -2.62777080  0.03269868 -80.36322  < 2.22e-16 ***
#> year2009     0.03742959  0.04542070   0.82406    0.409903    
#> year2010     0.01671577  0.04535227   0.36858    0.712444    
#> year2011    -0.09893826  0.04632765  -2.13562    0.032710 *  
#> year2012    -0.02434035  0.04569124  -0.53271    0.594232    
#> year2013     0.02536456  0.04514336   0.56187    0.574207    
#> year2014    -0.04734035  0.04578803  -1.03390    0.301182    
#> year2015    -0.05697712  0.04577360  -1.24476    0.213220    
#> year2016    -0.03688130  0.04570034  -0.80702    0.419652    
#> year2017    -0.08763337  0.04617991  -1.89765    0.057742 .  
#> year2018    -0.20504775  0.04738514  -4.32726 0.000015098 ***
#> year2019    -0.20485571  0.04749209  -4.31347 0.000016071 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> 
#> R-sq.(adj) =  0.0212   Deviance explained = 2.44%
#> -REML = -5872.4  Scale est. = 1         n = 2770
#> 
#> # A tibble: 4 × 4
#>   name              value interpretation         rule     
#>   <chr>             <dbl> <chr>                  <chr>    
#> 1 R2       2.117818155e-2 weak                   cohen1988
#> 2 SE       5.406166049e-3 <NA>                   <NA>     
#> 3 Lower CI 1.058229080e-2 very weak (negligible) cohen1988
#> 4 Upper CI 3.177407230e-2 weak                   cohen1988
#> 
#> # A tibble: 9 × 2
#>   name                    value
#>   <chr>                   <dbl>
#> 1 df             1.200000000e+1
#> 2 logLik         5.902573955e+3
#> 3 AIC           -1.177914791e+4
#> 4 BIC           -1.170210208e+4
#> 5 deviance       2.706397613e+3
#> 6 df.residual    2.758000000e+3
#> 7 nobs           2.77       e+3
#> 8 adj.r.squared  2.117818155e-2
#> 9 npar           1.2        e+1
Code
maper_mpepr_gam_6_by_misfs |>
  summarise_coefs_misfs() |>
  md_named_tibble()
Table 201: Value of the coefficients in the maper_mpepr_gam_6_by_misfs model.
A B C D
[Mean] -0.1144189191 -0.1703368677 -0.2441666065 -0.2758562571
(Intercept) -2.8637628473 -3.2229451649 -2.6073542309 -2.6277708030
year2009 0.0025303559 0.1197150374 0.0213516239 0.0374295883
year2010 0.1635636871 0.1500961951 0.0498158925 0.0167157667
year2011 0.1245353533 0.0353543990 0.0448692036 -0.0989382579
year2012 0.1071572667 0.0285685438 0.0146389834 -0.0243403455
year2013 0.2002576435 0.0386868122 0.0200388270 0.0253645642
year2014 0.1631059500 0.0591403696 -0.0330747248 -0.0473403461
year2015 0.1885582114 0.0994446436 -0.0495183316 -0.0569771236
year2016 0.2132648477 0.2010793199 -0.0153197277 -0.0368812975
year2017 0.2374574859 0.3164048959 -0.0672336169 -0.0876333747
year2018 0.0843458166 0.0853329872 -0.1556939854 -0.2050477495
year2019 0.0059592005 0.0450795489 -0.1525191913 -0.2048557068

Source: Created by the authors.

Code
dplyr::mutate(data, year = factor(year, ordered = FALSE)) |>
  dplyr::mutate(
    dplyr::across(
      .cols = dplyr::matches("^year$"),
      .fns = ~ .x |> as.character() |> as.numeric()
    )
  ) |>
  plot_gam_misfs(
    gam_models = maper_mpepr_gam_6_by_misfs,
    type = 6,
    x_label = "Years",
    y_label = "Predicted probability of MAPER & MPEPR"
  )
Figure 223: Predicted probability of MAPER & MPEPR (Severe/Moderate Thinness for Height (Magreza Acentuada/Moderada Para a Estatura)) as a function of the smoothed 12-month Standardized Precipitation Evapotranspiration Index (SPEI), based on the maper_mpepr_gam_6_by_misfs model. Shaded areas indicates the pointwise 95% prediction confidence interval, while the faded dots in the background represent the observed data.

Source: Created by the authors.

Acknowledgments

This analysis is part of the Sustentarea Research and Extension Group’s project: Global syndemic: the impact of anthropogenic climate change on the health and nutrition of children under five years old attended by Brazil’s public health system (SUS).

This research was supported by the Conselho Nacional de Desenvolvimento Científico e Tecnológico - Brazil (CNPq).

How to Cite

To cite this work, please use the following format:

Magalhães, A. R., Vartanian, D, & Carvalho, A. M. (2025). Global syndemic project data analysis: Report 3: Exploring potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019). Sustentarea Research and Extension Group at the University of São Paulo. https://sustentarea.github.io/gs-data-analysis-report-3

A BibTeX entry for LaTeX users is

@techreport{magalhaes2025,
  title = {Global syndemic project data analysis: Report 3: Exploring potential associations between childhood undernutrition and the Standardized Precipitation Evapotranspiration Index (SPEI) in Brazilian municipalities (2008–2019)},
  author = {{Arthur Ramalho Magalhães} and {Daniel Vartanian} and {Aline Martins de Carvalho}},
  year = {2025},
  address = {São Paulo},
  institution = {Sustentarea Research and Extension Group at the University of São Paulo},
  langid = {en},
  url = {https://sustentarea.github.io/gs-data-analysis-report-3}
}

References

Carvalho, A. M. de, Verly Jr, E., Marchioni, D. M., & Jones, A. D. (2021). Measuring sustainable food systems in Brazil: A framework and multidimensional index to evaluate socioeconomic, nutritional, and environmental aspects. World Development, 143, 105470. https://doi.org/10.1016/j.worlddev.2021.105470
Casella, G., & Berger, R. L. (2002). Statistical inference (2nd ed.). Duxbury.
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
Ehrl, P. (2017). Minimum comparable areas for the period 1872-2010: An aggregation of Brazilian municipalities. Estudos Econômicos (São Paulo), 47, 215–229. https://doi.org/10.1590/0101-416147182phe
Fick, S. E., & Hijmans, R. J. (2017). WorldClim 2: New 1-km spatial resolution climate surfaces for global land areas. International Journal of Climatology, 37(12), 4302–4315. https://doi.org/10.1002/joc.5086
Food and Agriculture Organization of the United Nations, International Fund for Agricultural Development, Pan American Health Organization, United Nations Children’s Fund, & World Food Programme. (2025). Latin america and the Caribbean regional overview of food security and nutrition 2024 – Building resilience to climate variability and extremes for food security and nutrition (p. 250) [Regional Overview]. FAO; IFAD; PAHO; UNICEF; WFP; https://doi.org/10.4060/cd3877en
Harris, I., Osborn, T. J., Jones, P., & Lister, D. (2020). Version 4 of the CRU TS monthly high-resolution gridded multivariate climate dataset. Scientific Data, 7(1), 109. https://doi.org/10.1038/s41597-020-0453-3
Instituto Brasileiro de Geografia e Estatística. (n.d.-a). Tabela 5938: Produto interno bruto a preços correntes, impostos, líquidos de subsídios, sobre produtos a preços correntes e valor adicionado bruto a preços correntes total e por atividade econômica, e respectivas participações - Referência 2010 [Table]. SIDRA. Retrieved November 16, 2023, from https://sidra.ibge.gov.br/tabela/5938
Instituto Brasileiro de Geografia e Estatística. (n.d.-b). Tabela 6579: População residente estimada [Table]. SIDRA. Retrieved November 16, 2023, from https://sidra.ibge.gov.br/Tabela/3939
Mehr, A. D., Sorman, A. U., Kahya, E., & Afshar, M. H. (2020). Climate change impacts on meteorological drought using SPI and SPEI: Case study of Ankara, Turkey. Hydrological Sciences Journal, 65(2). https://doi.org/10.1080/02626667.2019.1691218
Norde, M. M., Porciuncula, L., Garrido, G., Nunes-Galbes, N. M., Sarti, F. M., Marchioni, D. M. L., & de Carvalho, A. M. (2023). Measuring food systems sustainability in heterogenous countries: The Brazilian multidimensional index updated version applicability. Sustainable Development, 31(1), 91–107. https://doi.org/10.1002/sd.2376
Posit Team. (n.d.). RStudio: Integrated development environment for R [Computer software]. Posit Software. http://www.posit.co
R Core Team. (n.d.). R: A language and environment for statistical computing [Computer software]. R Foundation for Statistical Computing. https://www.R-project.org
Sistema de Vigilância Alimentar e Nutricional. (n.d.). Estado nutricional [Table]. openDataSUS. Retrieved November 16, 2023, from https://opendatasus.saude.gov.br/dataset/sisvan-estado-nutricional
Vicente-Serrano, S. M., Beguería, S., & López-Moreno, J. I. (2010). A multiscalar drought index sensitive to global warming: The standardized precipitation evapotranspiration index. https://doi.org/10.1175/2009JCLI2909.1
Wickham, H., Çetinkaya-Rundel, M., & Grolemund, G. (2023). R for data science: Import, tidy, transform, visualize, and model data (2nd ed.). O’Reilly Media. https://r4ds.hadley.nz
Wilkinson, M. D., Dumontier, M., Aalbersberg, Ij. J., Appleton, G., Axton, M., Baak, A., Blomberg, N., Boiten, J.-W., Da Silva Santos, L. B., Bourne, P. E., Bouwman, J., Brookes, A. J., Clark, T., Crosas, M., Dillo, I., Dumon, O., Edmunds, S., Evelo, C. T., Finkers, R., … Mons, B. (2016). The FAIR guiding principles for scientific data management and stewardship. Scientific Data, 3(1), 160018. https://doi.org/10.1038/sdata.2016.18
Wood, S. (n.d.). Mgcv: Mixed GAM Computation Vehicle with Automatic Smoothness Estimation [Computer software]. https://doi.org/10.32614/CRAN.package.mgcv